Hi
Please refer to article 14 - Income from employment, of the UK / Spain tax treaty.
It can be found at
2014 UK-Spain Double Taxation Convention
It states is you are resident in Spain, then UK employment is taxable only in Spain, unless you were physically in the UK undertaking the work.
In that case, the UK has the right to tax your employment income.
If you are not taxable on this employment income, you will need to submit a P85 (
Get your Income Tax right if you're leaving the UK (P85))
to report that you are not resident in the UK and that you have a UK employment.
Thank you