If you work in Spain
Employment or self-employment registered with Spanish Social Security can establish public healthcare entitlement. Complete the separate regional registration needed for a health card.
If the UK pays for your healthcare
People receiving a qualifying UK State Pension or certain exportable benefits may be entitled to an S1. Some workers covered by UK coordination arrangements can also qualify in specific circumstances. Obtain the document from the responsible UK institution then register it with the INSS.
EHIC and GHIC
These cards support necessary state healthcare during qualifying temporary stays. They are not the normal mechanism for registering as an ordinary resident in Spain.
When private cover may be needed
Private insurance may be required for a particular visa or residence route when no acceptable public entitlement exists. Check the route first rather than buying on the basis of nationality.