Hi Donal,
Depending on where you pay National Insurance contributions (UK or Ireland), once you retire you should be entitled to the Form S1 (certificate of entitlement), which allows you to transfer your right to State funded healthcare to Spain. If that's Ireland, then the use the information in the link that Cheryl has given you. If it's the UK, you need to contact the NHS Business Services Authority - you can email them at:
Kind regards,
Kim