Spain ceded Florida to the United States for several reasons. First, Spain was facing economic difficulties and was unable to afford to maintain control of Florida. Second, Spain was concerned about the growing influence of the United States in the region and feared that the United States would eventually take Florida by force. Third, Spain wanted to improve relations with the United States, which had been strained by the War of 1812.
The Adams–Onís Treaty resulted in the United States gaining control of Florida, as well as parts of the present-day states of Colorado, Wyoming, and New Mexico. Spain gained control of Texas and parts of the present-day states of California and Nevada. The treaty also established the border between the United States and Mexico, which has remained largely unchanged to this day.