You must tell the UK government offices that deal with your benefits, pension and tax if you are moving or retiring abroad.
Check the entry requirements for Spain.
Before you move to Spain you must apply for the appropriate visa from the Spanish consulates in London or Edinburgh, or the Spanish consulate in Manchester (details available from the Foreign embassies in the UK list. You must apply for your residence document as soon as you arrive in Spain. Your children must also be registered with their own residency documents.
Read the Spanish government’s guidance on:
the different types of residence permit available to you (in Spanish)