Generally speaking you don't need any special immunisations for Spain but it's a good idea to have an up-to-date tetanus vaccination if you are planning on travelling in rural places. Your GP may also recommend a Hepatitis A vaccination.
Check that any medication that you take is legal (and available) in Spain and make sure you have an ample supply to take with you. Pack tablets and medication in your hand luggage and if you have a particular medical condition which could require medical intervention abroad, such as severe heart disease, or you are pregnant, the
Foreign and Commonwealth Office recommends you take a letter from your GP with a medical summary and details of any treatment or current medication that you take. Equally, include the prescription and a letter from your GP for prescription medication like opiates and controlled drugs.