Mexico was originally the site of various Amerindian civilizations such as the Mayas and the Aztecs. The country was later invaded by Spain in 1519 which led to a prolonged colonial period that would last until the 19th century when the country finally gained its independence at the end of the war of independence.
The conflict was sparked when the U.S. annexed Texas and the Mexican government refused to recognize the secession of Texas which was the precursor to the annexation. The war, which began in 1846 and lasted for 2 years, was settled via the treaty of Guadalupe Hidalgo which led to Mexico giving up even more of its land to the US, including California. Mexico further transferred some of its territories (southern Arizona and New Mexico) to the U.S. via the Gadsden Purchase in 1854.
Lasting for 7 years, the 1910 revolution ended the rule of the dictator president Porfirio Diaz. The war was sparked when the U.S.-supported Diaz was proclaimed the winner of the 1910 elections despite mass popular support for his rival in the election Francisco Madero. After the war, the various groups that made up the revolutionary forces splintered as they lost the unifying goal of unseating Diaz - leading to a civil war. The U.S. intervened in the conflict including the involvement of the U.S. ambassador in the plotting of the 1913 coup d'état which overthrew Madero.
A major issue of contention between both countries is that of immigration from Mexico to the U.S. The September 11th attacks increased the fear of terrorists crossing over from Mexico leading to a tightening of immigration restrictions including a U.S. Senate bill, heavily criticized in Mexico, supporting the construction of a fence along the Mexican-American border.
North American Free Trade Agreement (NAFTA):
NAFTA led to the elimination of tariffs and other trade barriers between Mexico and the U.S. and serves as a multilateral platform for cooperation between both countries. The agreement increased trade volume and cooperation in both countries. NAFTA has come under attack from Mexican and American farmers and the political left claiming that it hurts the interest of local small farmers in both the U.S. and Mexico.
In Latin American politics, Mexico has acted as a counterweight to the policies of the new populist left characterized by Venezuela and Bolivia. This led to charges from some in Latin America that Mexico is blindly following U.S. commands. The biggest disagreements between the left and current Mexican leadership is whether to enlarge American led trade regimes, which has been Mexico's traditional approach, versus a more regional approach favoring Latin American cooperation and empowerment.