The Mexican-American War was fought exclusively in and around Texas, New Mexico, California and Northern/Central Mexico between 1846 and 1848.
This was fought soon after the Texas Revolution. The Texas Revolution was a fight for independence from Mexico by the "Tejas" portion of Mexico. At that time Mexico considered Texas a breakaway province.
One of the causes of this War were the continued claims to Texas from both the United States and Mexican governments. Other reasons were claims against the Mexican government by American citizens for damages during the continuous Mexican Revolutions of the period and the U.S. desire to claim California. At this time the U.S. was fearful that France or Britain may lay claim to California.
What has been debated as another cause of this War was the concept of "Manifest Destiny" which, simply stated, means the belief at the time was that the U.S. had a God-given right to occupy and "civilize" the whole continent. President Polk, who was a firm believer in the expansion of the United States westward, supported this concept. Historians have not been able to prove nor disprove this concept over the years.
A little known consequence of the war and resulting treaty was the Mexican Cession, where California, New Mexico. Arizona, Nevada, Utah and parts of Wyoming and Colorado were sold to the United States for 15 million dollars.
The Treaty of Guadalupe Hidalgo ended this war and set the Rio Grande as the border between Texas and Mexico, signed by Mexico and the United States on 2 February, 1848.