Capital and most populous city of Mexico
Mexico City is the capital and largest city of Mexico, and is also North America's most populous city. It is one of the most important cultural and financial centers in the world. Mexico City is located in the Valley of Mexico within the high Mexican central plateau, at an altitude of . The city has 16 boroughs or , which are in turn divided into neighborhoods or . 
The 2020 population for the city proper was 9,209,944, with a land area of . According to the most recent definition agreed upon by the federal and state governments, the population of Greater Mexico City is 21,804,515, which makes it the sixth-largest metropolitan area in the world, the second-largest urban agglomeration in the Western Hemisphere (behind São Paulo, Brazil), and the largest Spanish-speaking city (city proper) in the world. Greater Mexico City has a GDP of $411 billion in 2011, which makes it one of the most productive urban areas in the world. The city was responsible for generating 15.8% of Mexico's GDP, and the metropolitan area accounted for about 22% of the country's GDP. If it were an independent country in 2013, Mexico City would be the fifth-largest economy in Latin America.
Mexico City is the oldest capital city in the Americas and one of two founded by Indigenous people. The city was originally built on a group of islands in Lake Texcoco by the Mexica around 1325, under the name Tenochtitlan. It was almost completely destroyed in the 1521 siege of Tenochtitlan and subsequently redesigned and rebuilt in accordance with the Spanish urban standards. In 1524, the municipality of Mexico City was established, known as , and as of 1585, it was officially known as (Mexico City). Mexico City played a major role in the Spanish colonial empire as a political, administrative, and financial center. Following independence from Spain, the federal district was established in 1824.
After years of demanding greater political autonomy, residents were finally given the right to elect both a head of government and the representatives of the unicameral Legislative Assembly by election in 1997. Ever since, left-wing parties (first the Party of the Democratic Revolution and later the National Regeneration Movement) have controlled both of them. The city has several progressive policies, such as elective abortions, a limited form of euthanasia, no-fault divorce, same-sex marriage, and legal gender change. On 29 January 2016, it ceased to be the "Federal District" ( or ) and is now officially known as (or ), with a greater degree of autonomy. A clause in the Constitution of Mexico, however, prevents it from becoming a state within the Mexican federation, as long it remains the capital of the country.
Nicknames and mottos.
Mexico City was traditionally known as "La Ciudad de los Palacios" ("the City of the Palaces"), a nickname attributed to Baron Alexander von Humboldt when visiting the city in the 19th century, who, sending a letter back to Germany, said Mexico City could rival any major city in Europe. But it was English politician Charles Latrobe who really penned the following: "... look at their works: the moles, aqueducts, churches, roads—and the luxurious "City of Palaces" which has risen from the clay-built ruins of Tenochtitlan...", on page 84 of the Letter V of "The Rambler in Mexico".
During the colonial period, the city's motto was "Muy Noble e Insigne, Muy Leal e Imperial" (Very Noble and Distinguished, Very Loyal and Imperial). During Andrés Manuel López Obrador's administration a political slogan was introduced: "la Ciudad de la Esperanza" (lit. 'The City of Hope'). This motto was quickly adopted as a city nickname but has faded since the new motto, "Capital en Movimiento" ("Capital in Movement"), was adopted by the administration headed by Marcelo Ebrard, though the latter is not treated as often as a nickname in media. 
Up until 2013, it was common to refer to the city by the initialism 
"DF" from "Distrito Federal de México". Since 2013, the abbreviation "CDMX" (Ciudad de México) has been more common, particularly in relation to government campaigns.
The city is colloquially known as "Chilangolandia" after the locals' nickname "chilangos". Chilango is used pejoratively by people living outside Mexico City to "connote a loud, arrogant, ill-mannered, loutish person". For their part those living in Mexico City designate insultingly those who live elsewhere as living in "la provincia" ('the provinces', 'the periphery') and many proudly embrace the term chilango. Residents of Mexico City are more recently called "defeños" (deriving from the postal abbreviation of the Federal District in Spanish: D.F., which is read "De-Efe"). They are formally called "capitalinos" (in reference to the city being the capital of the country), but "[p]erhaps because capitalino is the more polite, specific, and correct word, it is almost never utilized".
History.
The oldest signs of human occupation in the area of Mexico City are those of the "Peñón woman" and others found in San Bartolo Atepehuacan (Gustavo A. Madero). They were believed to correspond to the lower Cenolithic period (9500–7000 BC). However, a 2003 study placed the age of the Peñon woman at 12,700 years old (calendar age), one of the oldest human remains discovered in the Americas. Studies of her mitochondrial DNA suggest she was either of Asian or European or Aboriginal Australian origin.
The area was the destination of the migrations of the Teochichimecas during the 8th and 13th centuries, people that would give rise to the Toltec, and Mexica (Aztecs) cultures. The latter arrived around the 14th century to settle first on the shores of the lake.
Aztec period.
The city of Mexico-Tenochtitlan was founded by the Mexica people in 1325 or 1327. The old Mexica city that is now referred to as Tenochtitlan was built on an island in the center of the inland lake system of the Valley of Mexico, which is shared with a smaller city-state called Tlatelolco. According to legend, the Mexicas' principal god, Huitzilopochtli, indicated the site where they were to build their home by presenting a golden eagle perched on a prickly pear devouring a rattlesnake.
Between 1325 and 1521, Tenochtitlan grew in size and strength, eventually dominating the other city-states around Lake Texcoco and in the Valley of Mexico. When the Spaniards arrived, the Aztec Empire had reached much of Mesoamerica, touching both the Gulf of Mexico and the Pacific Ocean.
Spanish conquest.
After landing in Veracruz, Spanish explorer Hernán Cortés advanced upon Tenochtitlan with the aid of many of the other native peoples,
arriving there on 8 November 1519. Cortés and his men marched along the causeway leading into the city from Iztapalapa (Ixtapalapa), and the city's ruler, Moctezuma II, greeted the Spaniards; they exchanged gifts, but the camaraderie did not last long. Cortés put Moctezuma under house arrest, hoping to rule through him.
Tensions increased until, on the night of 30 June 1520 – during a struggle known as "La Noche Triste" – the Aztecs rose up against the Spanish intrusion and managed to capture or drive out the Europeans and their Tlaxcalan allies. Cortés regrouped at Tlaxcala. The Aztecs thought the Spaniards were permanently gone, and they elected a new king, Cuitláhuac, but he soon died; the next king was Cuauhtémoc. Cortés began a siege of Tenochtitlan in May 1521. For three months, the city suffered from the lack of food and water as well as the spread of smallpox brought by the Europeans. Cortés and his allies landed their forces in the south of the island and slowly fought their way through the city. Cuauhtémoc surrendered in August 1521. The Spaniards practically razed Tenochtitlan during the final siege of the conquest.
Cortés first settled in Coyoacán, but decided to rebuild the Aztec site to erase all traces of the old order. He did not establish a territory under his own personal rule, but remained loyal to the Spanish crown. The first Spanish viceroy arrived in Mexico City fourteen years later. By that time, the city had again become a city-state, having power that extended far beyond its borders. Although the Spanish preserved Tenochtitlan's basic layout, they built Catholic churches over the old Aztec temples and claimed the imperial palaces for themselves. Tenochtitlan was renamed "Mexico" because the Spanish found the word easier to pronounce.
Growth of colonial Mexico City.
The city had been the capital of the Aztec Empire and in the colonial era, Mexico City became the capital of New Spain. The viceroy of Mexico or vice-king lived in the viceregal palace on the main square or Zócalo. The Mexico City Metropolitan Cathedral, the seat of the Archbishopric of New Spain, was constructed on another side of the Zócalo, as was the archbishop's palace, and across from it the building housing the city council or "ayuntamiento" of the city. A late seventeenth-century painting of the Zócalo by Cristóbal de Villalpando depicts the main square, which had been the old Aztec ceremonial center. The existing central plaza of the Aztecs was effectively and permanently transformed to the ceremonial center and seat of power during the colonial period, and remains to this day in modern Mexico, the central plaza of the nation. The rebuilding of the city after the siege of Tenochtitlan was accomplished by the abundant indigenous labor in the surrounding area. Franciscan friar Toribio de Benavente Motolinia, one of the Twelve Apostles of Mexico who arrived in New Spain in 1524, described the rebuilding of the city as one of the afflictions or plagues of the early period:
The seventh plague was the construction of the great City of Mexico, which, during the early years used more people than in the construction of Jerusalem. The crowds of laborers were so numerous that one could hardly move in the streets and causeways, although they are very wide. Many died from being crushed by beams, or falling from high places, or in tearing down old buildings for new ones. 
Preconquest Tenochtitlan was built in the center of the inland lake system, with the city reachable by canoe and by wide causeways to the mainland. The causeways were rebuilt under Spanish rule with indigenous labor. Colonial Spanish cities were constructed on a grid pattern, if no geographical obstacle prevented it. In Mexico City, the Zócalo (main square) was the central place from which the grid was then built outward. The Spanish lived in the area closest to the main square in what was known as the "traza", in orderly, well laid-out streets. Indigenous residences were outside that exclusive zone and houses were haphazardly located. Spaniards sought to keep indigenous people separate but since the Zócalo was a center of commerce for Amerindians, they were a constant presence in the central area, so strict segregation was never enforced. At intervals Zócalo was where major celebrations took place as well as executions. It was also the site of two major riots in the seventeenth century, one in 1624, the other in 1692.
The city grew as the population did, coming up against the lake's waters. As the depth of the lake water fluctuated, Mexico City was subject to periodic flooding. A major labor draft, the desagüe, compelled thousands of indigenous over the colonial period to work on infrastructure to prevent flooding. Floods were not only an inconvenience but also a health hazard, since during flood periods human waste polluted the city's streets. By draining the area, the mosquito population dropped as did the frequency of the diseases they spread. However, draining the wetlands also changed the habitat for fish and birds and the areas accessible for indigenous cultivation close to the capital. The 16th century saw a proliferation of churches, many of which can still be seen today in the historic center.
Economically, Mexico City prospered as a result of trade. Unlike Brazil or Peru, Mexico had easy contact with both the Atlantic and Pacific worlds. Although the Spanish crown tried to completely regulate all commerce in the city, it had only partial success.
The concept of nobility flourished in New Spain in a way not seen in other parts of the Americas. Spaniards encountered a society in which the concept of nobility mirrored that of their own. Spaniards respected the indigenous order of nobility and added to it. In the ensuing centuries, possession of a noble title in Mexico did not mean one exercised great political power, for one's power was limited even if the accumulation of wealth was not. The concept