Pipertommy
According to Lasors,
"An applicant may only apply to change the state of licence issue of a JAR-FCL licence provided that employment or normal residency is established in that state. NORMAL RESIDENCY means the place where a person usually lives for at least 185 days in each calender year because of personal and occupational ties...
This means that yes, you could do the training is Spain , get a Spanish licence and then convert to CAA. There are fees for this process.
However, you should get written approval from the CAA and Spanish authorities first, in order to cover yourself.
A list of recognised FTOs in Spain is also available on the CAA website.
If I were you I would find out how much the courses are to do in Spain at your choosen school, add living expenses and CAA fees for the conversion and then compare against doing all or part in UK to see if it is worth your while.
If in doubt about anything get it confirmed by the CAA and leave time (two months ago I sent an email to the CAA regarding another issue and am still awaiting a response) for responses, especially from the Spainsh side of things as they are slow.
Please read Lasors.
Good luck and safe flying.