You can use a UK driving licence in any European country for as long as the licence is valid, the licence has to be the EU licence two part with the plastic card with your photo and the paper counterpart. You do not have to change to a Spanish licence at the present time.
For residents, you have to comply with the driving laws for the country that you live, in Spain this means taking the driving medical at a trafico delegated medical centre. You need to carry the medical certificate in the car with your documents.
Remember, the UK licence is only valid for 10 years now even though you are entitled to it until you are 70 years of age, you have to get it renewed at Swansea if you don't want to change to a Spanish one.