A common misconception is that Spain gave Florida to Great Britain in exchange for Cuba. In reality, Spain ceded Florida to the United States in 1821 under the Adams–Onís Treaty (also called the Transcontinental Treaty). The agreement settled border disputes between the U.S. and Spanish territories, with Spain relinquishing East and West Florida. Cuba remained a Spanish colony until the Spanish–American War in 1898. Britain had earlier controlled Florida from 1763 to 1783 after the Seven Years' War, but that was a separate transaction.
Understanding the correct treaty and parties involved helps clarify the diplomatic history of North America in the early 19th century.