If you become residents as you will if you are going to live here, then if you work and earn then you will pay into the SS (social security system) on a monthly basis.
My father moved over when he was 67, became a resident and had a hip op within that same year on the Spanish SS.
I do both, pay into the SS and have private health insurance with Adeslas. Not because I don’t trust the health service, I do and have had good hospital treatment from them when needed. The private health care is very handy for just going to see the doctor, like right when you feel like it, I find it very convenient because if something does happen I just need to go to one of the private clinics here in Fuengirola and see a doc generally within 10 to 20 mins if it is not urgent. I am 50 and for the Top plan at Adeslas I pay 750 euros a year while my wife at 52 pays 850 (Older and female), we have been with them for about 15 years now and jumps in price as we get older. Coming in older or with previous health issues will push the rate up but most of these companies will give you a printed quote on the price scale for your years.
We have a clinic in Fuengirola called Angeles Nocturnas (Night angels), they are like a doctors surgery but they also have plans to get treatment from them for a fixed yearly fee, you won’t get hospital treatment but I do remember thinking it was very reasonable for what they offered. Maybe they have other clinics throughout Spain or maybe there are others with the same option, ‘Angeles Nocturnas’.
Hope this helps