The Treaty of Guadalupe Hidalgo was signed on February 2, 1848, ending the Mexican-American War and establishing the Rio Grande as the border between Texas and Mexico. This treaty resulted in Mexico ceding a vast portion of its northern territories to the United States, significantly impacting the demographics and governance of what would become the New Mexico Territory.