Mexico, officially the United Mexican States, is a country in the southern portion of North America. It is bordered to the north by the United States; to the south and west by the Pacific Ocean; to the southeast by Guatemala, Belize, and the Caribbean Sea; and to the east by the Gulf of Mexico. Mexico covers 1,972,550 square kilometers (761,610 sq mi), making it the world's 13th-largest country by area; with approximately 126,014,024 inhabitants, it is the 10th-most-populous country and has the most Spanish-speakers. Mexico is organized as a federation comprising 31 states and Mexico City, its capital. The capital is not only a primate city, with a population of approximately 21 million, but one of the world's largest cities. There are other major urban areas including Guadalajara, Monterrey, Puebla, Toluca, Tijuana, Ciudad Juárez, and León.Pre-Columbian Mexico traces its origins to 8,000 BCE and is identified as one of the six cradles of civilization that arose in Mesoamerica, most notably in succession the Olmec, Maya, and the lastly the Aztecs, which dominated in the century before European contact. Over two years of warfare (1519-1521), Hernán Cortés and thousands of indigenous allies conquered the Aztec Empire. Cortés founded Mexico City on the ruins of the Aztec capital of Tenochtitlan, establishing the Kingdom of New Spain within the Spanish Empire. The Catholic Church under the patronage of the Spanish monarch embarked upon conversion of the indigenous populations to Christianity, in the "spiritual conquest of Mexico." The mid-1500s discoveries of large deposits of silver outside the zone of settled indigenous populations led to Spanish territorial expansion northward. More importantly, silver became the motor of not only the Mexican economy, but also Spain's, Europe's and the world's. The massive influx of wealth brought about a price revolution in Western Europe and also had an impact on China. Colonial Mexico developed distinct regions, with the main axis being Mexico City to the Gulf Coast port of Veracruz, and to a lesser extent the Pacific Coast port of Acapulco for the China trade, and from Mexico City to the silver mining zones of Zacatecas and Guanajuato. Over time, a distinct Mexican identity formed, based on a fusion of European and indigenous customs and also shaped by Africans brought to Mexico as slaves.
Mexico's early history as an independent nation state was marked by political and socioeconomic upheaval. The initial political transition was to monarchy in 1821-22, with royalist-turned-insurgent military officer Agustín de Iturbide becoming Emperor Agustín I. He was forced to abdicate and Mexico drafted its first post-independence constitution creating a federal republic. Liberal and conservative factions constantly changing the form of government. The country was invaded by two foreign powers during the 19th century: first, after the Texas Revolution by American settlers, which led to the Mexican–American War and huge territorial losses to the United States in 1848. Liberal reforms were enshrined in the Constitution of 1857, which sought to integrate indigenous communities and curtail the power of the military and the Catholic Church as privileged institutions and establishing equality before the law. Conservatives rejected the liberal project and lost the civil war of Reform, only to seek external aid from France (1862-67). The French invasion was followed by the installation of Maximilian Habsburg as emperor against the Republican resistance led by liberal President Benito Juárez. With the end of the American Civil War in 1865 and France's withdrawal of its army, Republicans executed Emperor Maximilian. The last decades of the 19th century were dominated by liberal revolutionary war hero, Porfirio Díaz, who sought to modernize Mexico and restore order. The relatively peaceful era of the Porfiriato (1876-1910) ended with the outbreak of the decade-long Mexican civil war (Mexican Revolution). The conflict killed approximately 10% of the population and after which the victorious Constitutionalist faction drafted an even more socially-oriented 1917 Constitution, which remains in effect to this day with amendments. Revolutionary generals ruled as a succession of presidents until the assassination of Alvaro Obregón in 1928, which led to the formation of the Institutional Revolutionary Party (PRI) the following year. General Lázaro Cárdenas broke the cycle of personalist presidential rule, withdrawing from politics at the end of his six-year term, 1934-40. After World War II, in which Mexico played as important role for the U.S. war effort, Mexico embarked on developmentalist policies. Cracks appeared in the apparently stable political and economic system in the 1960s. Mexico's hosting of the 1968 Olympics was to demonstrate its new position in the world, but it is most remembered for the government's political repression, culminating in the October 1968 Tlatelolco Massacre. The PRI won the 1988 election through fraud. President Carlos Salinas de Gortari pursued neoliberal economic policies and became part of the North American Free Trade Agreement. On New Year's Day 1994 when the treaty came into force, a major indigenous rebellion broke out in the state of Chiapas. The PRI governed Mexico until 2000, with the victor opposition conservative candidate, Vicente Fox.
Mexico is a developing country, ranking 74th on the Human Development Index, but has the world's 15th-largest economy by nominal GDP and the 11th-largest by PPP, with the United States being its largest economic partner. Its large economy and population, global cultural influence, and steady democratization make Mexico a regional and middle power; it is often identified as an emerging power but is considered a newly industrialized state by several analysts. However, the country continues to struggle with social inequality, poverty and extensive crime. It ranks poorly on the Global Peace Index, due in large part to ongoing conflict between the government and drug trafficking syndicates, violently competing for the US market and trade routes. This "drug war" has led to over 120,000 deaths since 2006.Mexico ranks first in the Americas and seventh in the world for the number of UNESCO World Heritage Sites. It is also one of the world's 17 megadiverse countries, ranking fifth in natural biodiversity. Mexico's rich cultural and biological heritage, as well as varied climate and geography, makes it a major tourist destination: as of 2018, it was the sixth most-visited country in the world, with 39 million international arrivals. Mexico is a member of United Nations, the G20, the Organisation for Economic Co-operation and Development (OECD), the World Trade Organization (WTO), the Asia-Pacific Economic Cooperation forum, the Organization of American States, Community of Latin American and Caribbean States, and the Organization of Ibero-American States.