Florida is the original site of Spain's exploration onto the North American continent. Spanish explorers had already laid claim to most of the Caribbean islands including Cuba. By the early 1800s Spain found it difficult to maintain garrisons and colonies in Florida. The Florida territory had become lawless and a problem for Spain and it's neighbor to the north, the United States. Spain decided it would be better to give Florida to the U.S, so in 1821 they ceded it to the U.S. with the Adams-Onis Treaty.

More Info: en.wikipedia.org