The correct response is:
By winning a war against Mexico.
The territory you are referring to was acquired through the Treaty of Guadalupe Hidalgo, which ended the Mexican-American War in 1848. This treaty resulted in the United States gaining significant land, including parts of present-day California, Nevada, Utah, Arizona, and New Mexico, as well as portions of Colorado and Wyoming.