Info on this can be found in many places. The paragraph below is from http://www.acespana.org/acespana/info_572.htm where there is further information.
“To be eligible for health care entitlements as a UK State pensioner living in Spain, you must have been issued with form E121 for yourself and any members of your family and had the form registered with the authorities who run the sickness insurance scheme in Spain. You will normally be issued with the form E121 in duplicate when you inform DWP of your intention to move to Spain and to receive your pension or benefit there. Once you have the forms they should be taken to your nearest Instituto Nacional de Seguridad Social (INSS) office for registration. One copy of the form will be retained by the Spanish authorities and the other will be returned to DWP in Newcastle to await claims for your health care from the Spanish authorities. You will be issued with a health card to enable you to receive any health care required.”