Since the Louisiana Purchase in 1803, all European influence in the western hemisphere was gone with one exception - Spain. However, Spain was losing its influence in the region quickly. The Spanish lost their status in North America and they also lost Mexico as well as almost all territory in South America. There were only a few remaining areas. One was Cuba where United States businesses have over $50 million invested in sugar and the people of Cuba desired their independence from Spain.
In 1823, President James Monroe issued the "Monroe Doctrine" which warned Europe not to become involved in the affairs of the Western Hemisphere. It drew an imaginary line down the middle of the Atlantic Ocean. When Cuba declared their independence from Spain, the US supported the Cuban rebels. In 1898, the USS Maine sailed to Cuba and was docked in Havana Harbor. In February of 1898, the Maine exploded and sunk. The US blamed Spain for the destruction of the Maine and declared war.
Spain did not want to fight the United States for they knew they could not win. Teddy Roosevelt joined the war and led the "Rough Riders" at the battle of San Juan Hill. It was a slaughter. Shortly after, Spain surrendered to the United States. In total, the war lasted just under 4 months and is the shortest declared war in US history. Spain surrendered all remaining territories
The US obtained the Philippeans, Puerto Rico, and Guam as territories.
Cuba received its independence and became a "protectorate" of the US until 1959. A protectorate is a independent nation that relies on another nation for its military protection.
Secretary of State John Hay called it "a Splendid Little War."