Double taxation occurs when the same income is taxed twice: a foreign company's dividend first suffers withholding in its home country and is then taxed in Spain as savings income. Without correction, a US dividend would pay 15% there and from 19% here — more than a third of the payment gone.
To prevent this there are double-taxation treaties: bilateral agreements that split the tax pie between the two countries and let you credit in Spain what was already paid abroad, within limits.
The mechanism is the international double-taxation credit in your tax return:
US case (treaty at 15%): €100 dividend. Withholding at source: €15. Spain's tax is 19% (€19), but you credit the €15 already paid → you pay €4. Effective total: 19% — double taxation fully corrected.
Swiss case (35% withholding): €100 dividend. Switzerland keeps €35. Spain only allows crediting up to the treaty limit (€15) → you pay another €4 here. You have borne €39 in total, and the €20 over-withheld does not come back through your Spanish return: it must be claimed from the Swiss administration with its own forms. Until you do, that excess is genuine double taxation.
The general rule: the Spanish credit is the lower of what was withheld under the treaty and what Spain would charge on that income.
Yes: include the foreign dividends and the withholding suffered in your tax return. With a foreign broker the data is not pre-filled; with a Spanish broker it usually reaches your draft, but it is worth checking.
Those withholding above the treaty rate: Switzerland (35%) is the classic case, followed by Germany and France without prior paperwork. The UK (0%) and the Netherlands (15%) are the most convenient.
It depends on the amount: the process requires forms, tax-residence certificates and months of waiting. For small annual flows, many investors simply avoid the problematic jurisdictions instead.