Hi Carlos Lopez,
You would need to review the guidance on the UK / Spain tax treaty here:
2014 UK-Spain Double Taxation Convention
Article 1 covers dividends and advises that a resident of the UK, who has dividends arising in Spain, is only taxable on that dividends in the UK.
To ensure that no tax is deducted in Spain, you would need to request a certificate of residence from HMRC, which you can do here:
How to apply for a certificate of residence to claim tax relief abroad.
You would send this certificate to the Spanish tax authorities along with their forms to ensure that no tax is deducted from the dividends or claim a repayment of the tax if already paid.
Thank you.