Whilst in Spain, anyone with a foreign licence is allowed to drive legally, that is if you are a visitor not exceeding 6 months stay. As a E.U. national with a EU/EEA driving licence, that includes the U.K., you are
permitted to use your own country’s driving licence even as a resident, however if you reside for more than 2 years you will be obliged to exchange or renew your licence.
You must obtain Spanish residency before you can exchange or renew your licence. You should note that a NIE number does not necessarily mean you have Spanish residency. Also if you have a “pardon” (register in the local census), it is not a residence either.
You may be required to provide a medical certificate with you application to exchange your driver’s licence for a Spanish one. The certificate will state how many years are to be allowed until the next medical certificate. If in doubt about applications and procedures just contact a ‘gestoria’ and they will do all the necessary for you.
At this point an interesting question arises for UK nationals. What happens after the UK leaves the EU? Does it mean that the Spanish licence will no longer be valid in the UK? What happens with UK Spanish residents?