The United States of America shares a unique and often complex relationship with Mexico. With shared history stemming back to the Texas Revolution (1835–1836) and the Mexican–American War (1846–1848), several treaties have been concluded between the two nations, most notably the Gadsden Purchase, and multilaterally with Canada, the North American Free Trade Agreement (NAFTA). Mexico and the United States are members of various international organizations, such as the Organization of American States and the United Nations. Boundary disputes and allocation of boundary waters have been administered since 1889 by the International Boundary and Water Commission, which also maintains international dams and wastewater sanitation facilities. Once viewed as a model of international cooperation, in recent decades the IBWC has been heavily criticized as an institutional anachronism, bypassed by modern social, environmental, and political issues.Robert J. McCarthy, Executive Authority, Adaptive Treaty Interpretation, and the International Boundary and Water Commission, U.S.-Mexico, 14-2 U. Denv. Water L. Rev. 197(Spring 2011) (also available for free download at https://ssrn.com/abstract=1839903).Illegal immigration, weapons sales, and drug smuggling continue to be contentious issues in 21st-century Mexico-United States relations.

Post-Columbian era

Early history U.S.–Mexico relations grew out of the earlier relations between the fledgling nation of the United States and the Spanish Empire and its viceroyalty of New Spain.

Post-American Revolution Modern Mexico formed the core area of the Viceroyalty of New Spain at the time the United States gained its independence in the American Revolutionary War (1775–1783). Spain had served as an ally to the American colonists in that war.

The aspect of Spanish-American relations that would bear most prominently on later relations between the U.S. and Mexico was the ownership of Texas. In the early 19th century, the United States claimed that Texas was part of the territory of Louisiana, and therefore had been rightfully acquired by the United States as part of the Louisiana Purchase from France in 1803. The Spanish, however, claimed it was not, as the western boundaries of Louisiana were not clearly defined.Rives, pp. 1–2; 11–13. In 1819, the dispute was resolved with the signing of the Adams–Onís Treaty, in which the United States relinquished its claims to Texas and instead purchased Spanish Florida.Rives, pp. 18–19.

In 1821, New Spain gained its independence from Spain and established the First Mexican Empire under the rule of Agustín de Iturbide, who had initially fought in the royal army against the insurgents in the independence from Spain. Independent Mexico was soon recognized by the United States.Rives, p. 45. The two countries quickly established diplomatic relations, with Joel Poinsett as the first envoy.Rives, p. 38, 45–46. In 1828 Mexico and the United States confirmed the boundaries established by the Adams–Onís Treaty by concluding the Treaty of Limits, but certain elements in the United States were greatly displeased with the treaty, as it relinquished rights to Texas.Rives, pp. 24–25. Poinsett, a supporter of the Monroe Doctrine, was convinced that republicanism was the only acceptable form of government for all countries in the Americas, and tried to influence the government of Agustín de Iturbide, which was beginning to show signs of weakness and divisiveness. Poinsett was initially sent to negotiate the acquisition of new territories for the United States, including Texas, New Mexico, and Upper California, as well as parts of Lower California, Sonora, Coahuila, and Nuevo León; but Poinsett's offer to purchase these areas was rejected by the Mexican Ministry of Foreign Affairs headed by Juan Francisco de Azcárate.Timothy J. Henderson, A Glorious Defeat: Mexico and Its War with the United States (New York: Macmillan,2008), 40. He became embroiled in the country's political turmoil until his recall in 1830, but he did try to further U.S. interests in Mexico by seeking preferential treatment of U.S. goods over those of Britain, attempting to shift the U.S.–Mexico boundary, and urging the adoption of a constitution patterned on that of the U.S.Riedinger, "Joel Roberts Poinsett," p. 1095. Poinsett often interfered in the Affairs of the newly born Republic, and provoked disagreements with British charge d'affaires Henry George Ward.Timothy J. Henderson, A Glorious Defeat: Mexico and Its War with the United States (New York: Macmillan,2008), p. 42. Texas remained a focal point of U.S-Mexico relations for decades. The relationship was further affected by internal struggles within the two countries: in Mexico these included concerns over the establishment of a centralized government, while in the United States it centered around the debate over the expansion of slavery, which was expanded to the Mexican territory of Texas. Some Mexican intellectuals, including José Vasconcelos would later assign the term Poinsettismo, in reference to Joel Roberts Poinsett, to designate any act of political or cultural meddling or interference by the United States in Mexican and Latin American affairs.

The first two Mexican envoys to Washington, D.C. were José Manuel Zozaya y Bermúdez and José Anastasio Torrens. Beginning in the 1820s, Americans led by Stephan F. Austin and other non-Mexicans began to settle in eastern Texas in large numbers. These Anglo-American settlers, known as Texians, were frequently at odds with the Mexican government, since they sought autonomy from the central Mexican government and the expansion of black slavery into Mexico, which had abolished the institution in 1829 under Mexican president Vicente Guerrero. Their disagreements led to the Texas Revolution, one of a series of independence movements that came to the fore following the 1835 amendments to the Constitution of Mexico, which substantially altered the governance of the country. Before the Texas Revolution, the general public of the United States was indifferent to Texas, but afterward, public opinion was increasingly sympathetic to the Texans.Rives, pp. 262–264. Following the war, a Republic of Texas was declared, though independence was not recognized by Mexico, and the boundaries between the two were never agreed upon. In 1845, the United States annexed Texas, leading to a major border dispute and eventually to the Mexican-American War.

Mexican–American War (1846–1848)

The Mexican–American War was fought from 1846 to 1848. Mexico refused to acknowledge that its runaway state of Texas had achieved independence and warned that annexation to the United States would mean war. The United States annexed Texas in late 1845, and the war began the next spring.David M. Pletcher, The Diplomacy of Annexation: Texas, Oregon, and the Mexican War (1973). U.S. President James K. Polk encouraged Congress to declare war following several skirmishes on the Mexican–American border.Daniel Walker Howe, What Hath God Wrought: The Transformation of America, 1815–1848, at 741 (2007). The war proved disastrous for Mexico; the Americans seized New Mexico and California and invaded Mexico's northern provinces. In September 1847, U.S. troops under General Winfield Scott captured Mexico City.Timothy J. Henderson, A Glorious Defeat: Mexico and Its War with the United States (2007). The war ended in a decisive U.S. victory; the Treaty of Guadalupe Hidalgo ended the conflict. As a result, Mexico was forced to sell all of its northernmost territory, including California and New Mexico, to the United States in the Mexican Cession. Additionally, Mexico relinquished its claims to Texas, and the United States forgave Mexico's debts to U.S. citizens. Mexicans in the annexed areas became full U.S. citizens.

There had been much talk early in the war about annexing all of Mexico, primarily to enlarge the areas open to slavery. However, many Southern political leaders were in the invasion armies, and they recommended against total annexation because of the differences in political culture between the United States and Mexico.

In 1854, the United States purchased an additional of desert land from Mexico in the Gadsden Purchase; the price was $10 million. The goal was to build a rail line through southern Arizona to California.

1850s

Mexican President Antonio López de Santa Anna sold Mexican territory to the United States in which is known as the Gadsden Purchase, allowing the U.S. to build a railway line more easily through that region. That purchase played a significant role in the ouster of Santa Anna by Mexican liberals, in what is known as the Revolution of Ayutla, since it was widely viewed as selling Mexico's patrimony.

As the liberals made significant political changes in Mexico and a civil reform war broke out between conservative opponents to the liberal reform, the liberal government of Benito Juárez negotiated with the U.S. to enable the building of an interoceanic route in southern Mexico. A treaty was concluded in 1859 between Melchor Ocampo and the U.S. representative Robert Milligan McLane, giving their names to the McLane-Ocampo Treaty. The U.S. Senate failed to ratify the treaty. Had it passed, Mexico would have made significant concessions to the U.S. in exchange for cash desperately needed by the liberal Mexican government.

Post-American Civil War

1860s

In 1861, Mexican conservatives looked to French leader Napoleon III to abolish the Republic led by liberal President Benito Juárez. France favored the secessionist Southern states that formed the Confederate States of America in the American Civil War, but did not accord it diplomatic recognition. The French expected that a Confederate victory would facilitate French economic dominance in Mexico. Realizing the U.S. government could not intervene in Mexico, France invaded Mexico and installed an Austrian prince Maximilian I of Mexico as the puppet ruler of a Second Mexican Empire in 1864. Owing to the shared convictions of the democratically elected government of Juárez and U.S. President Lincoln, Matías Romero, Juárez's minister to Washington, mobilized support in the U.S. Congress and the U.S. protested France's violation of the Monroe Doctrine. Once the American Civil War came to a close in April 1865, the U.S. allowed supporters of Juárez to openly purchase weapons and ammunition and issued stronger warnings to Paris. Napoleon III ultimately withdrew his army in disgrace, and Emperor Maximilian, who remained in Mexico even when given the choice of exile, was executed by the Mexican government in 1867. The support that the U.S. had accorded the liberal government of Juárez, by refusing to recognize the government of Maximilian and then by supplying arms to liberal forces, helped improve the U.S.–Mexican relationship.

At war's end, numerous Confederates fled to exile in Mexico. Many eventually returned to the U.S.Todd W. Wahlstrom, The Southern Exodus to Mexico: Migration Across the Borderlands After the American Civil War (U of Nebraska Press, 2015).

The Porfiriato (1876–1910)