EU residents are entitled to free medical and hospital care whilst on holiday, which you can make use of at Tenerife's public healthcare centres. In order to access this service, you will need a European Health Card, which you will need to apply for in your home country. If you live in Spain, all you need to do is show your regional health card from the area you live in.
If you do not have a European Health Card, you will be required to pay for any medical expenses in advance, and you can then ask to have them refunded in your home country.
Health cards are not valid for use at private centres, so you will have to pay for any medical attention you seek there or provide proof that you have medical insurance if accepted by the specific centre you go to.
Bear in mind that European Health Cards also do not cover specific medical treatment, dental care (except for emergency extractions), or repatriation in the event of illness. It is also important to note that they are valid for a limited time.
Other countries that are entitled to the same healthcare as EU residents include Switzerland, Norway, Iceland, Liechtenstein, Andorra, Brazil, Chile, Ecuador, Paraguay and Peru. In all other cases, healthcare services must be paid for unless they are covered by insurance.