This area of tax on dividends and capital gains external to Spain is the 'grey' area. Probably very wise to get a ruling , hopefully with some liability, from one of the 'Big 4'.
This from a financial advisor in Spain who claims to have much experience of the 'Beckham Law'...