The annexation led quickly to war with Mexico in 1846. The victorious United States came away with control of the American Southwest and California through the Treaty of Guadalupe in 1848. The slave-based cotton production boomed as the number of slaves in Texas increased from 12,500 in 1840 to almost 170,000 in 1860.