es, as a non-resident property owner in Spain, you are allowed to purchase a Spanish-registered car. You can drive it with your UK driving license during the two 90-day periods you are allowed to stay in the EU.
However, you do not need an International Driving Permit (IDP) if your UK license is in English and you are just visiting. An IDP is typically only necessary if you're planning to stay longer or for additional paperwork in certain countries, but for short stays, your UK license should suffice.
If you decide to stay in Spain longer or become a resident, you may need to exchange your UK driving license for a Spanish one, depending on the current rules.