Municipalities of Spain

The municipality (municipio,, municipi, concello, udalerria, conceyu) is one of the two fundamental territorial divisions in Spain, the other being the provinces.

Organisation
Although provinces are groupings of municipalities, there is no implied hierarchy or primacy of one over the other. Instead the two entities are defined according to the authority or jurisdiction of each (competencias). Some autonomous communities also group municipalities into entities known as comarcas (districts) or mancomunidades (commonwealths).

The governing body in most municipalities is called ayuntamiento (municipal council or corporation), a term often also used to refer to the municipal headquarters (city/town hall). The ayuntamiento is composed of the mayor (Spanish: alcalde), the deputy mayors (Spanish: tenientes de alcalde) and the deliberative assembly (pleno) of councillors (concejales). Another form of local government used in small municipalities is the concejo abierto (open council), in which the deliberative assembly is formed by all the electors in the municipality.

The operation of the municipalities is broadly outlined by the 1985 Local Government Act. The Statutes of Autonomy of the various autonomous communities also contain provisions and many sectorial laws from national and autonomous community government determine the functions and powers of ayuntamientos. In general, municipalities enjoy a large degree of autonomy in their local affairs: many of the functions of the comarcas and provinces are municipal powers pooled together.

All citizens of Spain are required to register in the municipality they live in, and after doing so, they are juridically considered "neighbors" (residents) of the municipality, a designation that grants them various rights and privileges, and which entail certain obligations as well, including the right to vote or be elected for public office in said municipality. The right to vote in municipal elections is extended to Spanish citizens living abroad. A Spaniard abroad, upon registering in a consulate, has the right to vote in the local elections of the last municipality they resided in. A Spanish citizen born abroad must choose between the last municipality his or her mother or father last lived in.

In numbers
As of 2022, there were a total of 8,131 municipalities in Spain, including the autonomous cities of Ceuta and Melilla. In the Principality of Asturias, municipalities are officially named concejos (councils). The average population of a municipality is about 5,300, but this figure masks a huge range: the most populous Spanish municipality is the city of Madrid, with a population of 3,305,408 (2022), while several rural municipalities have fewer than ten inhabitants (Illán de Vacas, had a population of three in 2022).

Almost 40% of the Spanish population resides in just 62 municipalities with more than 100,000 inhabitants. 84% (6,817) of municipalities have less than 5,000 inhabitants. Castile and León alone account for 28% of municipalities but they constitute less than 6% of the population of Spain. A European report said that one of the most important problems facing local governments in Spain is the very high number of little towns with a low number of inhabitants.

The area of the municipal territory (Spanish: término municipal) usually ranges 2–40 km2, but some municipalities span across a much larger area, up to the 1,750.33 km2 of Cáceres', the largest municipality in the country. The average land area of a Spanish municipality is about 62.23 km2, while the average population is about 5,988 people.

History
Municipalities were first created by decree on 23 May 1812 as part of the liberal reforms associated with the new Spanish Constitution of 1812 and based on similar actions in revolutionary France. The idea was to rationalise and homogenise territorial organisation, do away with the prior feudal system and provide equality before the law of all citizens.

Between 1812 and 1931, the legislation regarding municipal organisation was changed more than 20 times, and there were 20 addition and unsuccessful proposals for change.