Postal codes were introduced and standardized in Spain in 1985, when Correos (the national postal service of Spain) introduced automated mail sorting. The first two digits (ranging 01–52) of the postal code correspond to one of the fifty provinces of Spain (as listed in general alphabetical order, with some exceptions), plus the two autonomous cities on the African coast.
Some codes are reserved for special use at the province capital:
Large cities such as Madrid and Barcelona, were divided into postal districts (zonas in Spanish) similar to the arrondissement system in Paris.
These former postal districts were incorporated into the five-digit postal codes: