The Mexican–American War was an armed conflict between the United States and Mexico from 1846 to 1848. America won this war. Under The Treaty of Guadalupe Hidalgo, Mexico was forced to sell the territories of Alta California and New Mexico to the United States.