Depends which country you want to issue the CPL - UK or Spain.
To do the 50/50 idea of writtens in one state, flying in another, requires mutual consent of both states - and I very much doubt that the CAA will accept a Spanish flight test for CPL issue.
Maybe the Spanish will accept British written exams though.
You'll have to ask them.