If you remain a UK resident whilst you spend time in Spain, your European Health Insurance Card (EHIC) should cover your immediate healthcare needs.
Every resident of Spain has a right to healthcare. The Spanish healthcare system is a non-contributory system paid from tax money. Each autonomous community has its own budget. If you are a non-EU national living in Spain, you are entitled to healthcare only if you are a legal resident and currently paying for social security. This means that you must either work in Spain or be self-employed there. Citizens of EU member states who are living in Spain should see if they can get international coverage from their country of origin. They will automatically have access to health coverage in Spain once they become legal Spanish residents.
If you are working in Spain, either for a company or as sole trader, you will be paying into the social security system and so will be able use the health service for all medical needs. Pensioners from EU countries are treated free of charge, but recent changes have introduced a charge for prescriptions to pensioners depending on their income in Spain. For example, a pensioner earning less than €18,000 (approx. £14,500) a year will have to pay 10% of the cost of their prescription medicine per year, and those earning greater amounts will pay more. Those living in Spain unregistered do not have access to medical care except in the case of emergency, pregnancy, contagious disease or if they are under 18. Doctors do however often treat patients regardless, or refer cases to the European Court of Human Rights.
Assuming you are a resident in Spain, once you have bought your property and moved into it, declared yourself resident at the town hall and at the tax authority, you will have the same rights to free healthcare as a Spanish person. The health service is extensive throughout the country so you will find your local health centre close by and will need to then register yourself and all family members. This is where you will go for routine medical services such as GPs, paediatricians and nurses. They will usually also provide a first call emergency service 24 hours a day. For anything other than an emergency, you will need an appointment and waiting times vary from centre to centre.
Specialists are based at the local hospitals and your GP will refer you when necessary. Local hospitals are well run, clean and efficient but rarely have extra facilities such as coffee shops or family rooms. Visiting times are longer than in the UK and there is often no limit to the number of people allowed to visit at one time, so it can become noisy. However, medical attention is generally very good and caring. All hospitals have outpatients departments. Nowadays many GPs and specialists speak English, but it is not advisable to assume they will.
There are numerous public and private hospitals and medical centres in Spain, and for those who have taken early retirement or are not working, private healthcare is the best option. This can be provided by UK Health Insurance providers or Spanish ones, and the cost will depend very much on your age and medical history. An example is Sanitas, a Spanish company which is part of BUPA who on average will charge around €800 (approx. £640) a year for couple over 50. Their private hospitals have staff who speak English as well as Spanish. With private insurance you can choose your hospital.
Shop around as you must consider what private health insurance companies provide and perhaps most importantly, what they don't! Read the small print. Most companies have their terms and conditions available in English. It is a good idea to go to a Spanish (or English) insurance broker who will shop around for your particular requirements.
Dentists are always private in Spain and are usually of a very high quality. However, they will usually require a high payment that is not covered by your health insurance. Medication can only be purchased at a pharmacy, Farmacías, but these will usually be found on every street.
Finally, you should understand that if you are resident in Spain, when you go to the UK you will only be entitled to NHS emergency services with your EHIC. You may therefore want to consider private medical insurance to cover you in both countries or in Europe as a whole.