If you need to submit a foreign document in any Spanish city, you may need to have it translated and legalised. The most common way to do this is via the Hague Apostille; the apostille can be obtained through notaries or the regional offices of the Ministry of Justice. A certified translation is then required.
The format of the apostille varies from country to country, but it is usually added at the end or on the back of the document. If the country is not a party to the Hague Convention.