No doubt you already have the answer to your question, but just in case -
"do we have to take out medical insurance in Spain or can we just come back to the uk and just use the NHS?"
You can use your UK issued EHIC for emergencies whilst in Spain. But it won't cover certain things, such as repatriation, and you can't see a GP or get prescriptions etc. (although many drugs that are prescription only in the UK can be bought over the counter in Spain), so it would be advisable to get private medical insurance of some kind. As long as you remain UK residents, you can pop back to the UK anytime to use the NHS. But this means you must not stay longer than 182 days a year in Spain.Theoretically you shouldn't stay more than 3 consecutive months without registering as a foreign resident. I cannot advise you not to register, only suggest that doing so may complicate matters for you.