European Health Card
If you are a Spanish resident (ie. living permanently in & registered in Spain), and you need to receive medical treatment in the EU whilst

If you are a Spanish resident (ie. living permanently in & registered in Spain), and you need to receive medical treatment in the EU whilst travelling abroad, you are entitled to such treatment at a reduced cost or even for free. Please note that the card is FREE although unofficial sites may try and charge you.
However, to obtain treatment you will need to take a European Health Insurance Card (EHIC) with you. The European Health Insurance Card (EHIC) is a personal card, is supplied free of charge, and certifies the holder's right to receive health benefits that are deemed necessary from a medical point of view, during a temporary stay in any of the countries of the European Union (Germany, Austria, Belgium, Bulgaria, Cyprus, Denmark, Slovakia, Slovenia, Estonia, Finland, France, Greece, Hungary, Ireland, Italy, Latvia, Lithuania, Luxembourg, Malta, Netherlands, Poland, Portugal, Czech Republic, Romania, Sweden) and can include the countries of Iceland, Liechtenstein, Norway and Switzerland, depending on the circumstances. The EHIC is valid from the date of receipt until the expiry date printed on the card. Please note that the EHIC is NOT to be used if you are travelling abroad specifically to receive medical treatment.
Visit the following link (the Spanish Social Security Page) and fill out all the details to receive your free card in the post. Please note that the card can only be sent to the address that is registered on your file at the Social Security. Also, the page is only available in Spanish.
UPDATE:
If you are UK resident, since leaving the Eurpoean Union, your EHIC card is no longer valid. Click herefor information about applying for the replacement GHIC (Global Health Insurance Card).