Legalisation is an administrative act whereby a foreign public document is validated, by verifying the authenticity of the signature on the document, and the capacity in which the signatory of the document has acted.
Unless there is a legal instrument providing exemption from that obligation, all foreign public documents must be legalised in order to be valid in Spain, and all Spanish public documents must be legalised to be valid abroad.
Further information on this can be found here.