If you live in Spain but can't use the public health system as a result of not having social security, there is another way to access public healthcare. Find out if this ‘special agreement’ is right for you or if you're better off getting private healthcare.
If you're planning on moving to Spain and are not retired or don't have a job yet, you'll need to get private healthcare insurance in order to qualify for residency.