The US was given control of Cuba in 1898 by the Treaty of Paris which ended the Spanish-American War. The treaty put the United States in total control of Cuba and the US took over military possession of the nation from January 1 1899 until May 20 1902, when the US possession of Cuba ended.
Cuba became a Spanish colony in 1511 when the first Spanish settlement was founded by Diego Velázquez de Cuéllar at Baracoa. The Spanish rule ended in 1898 following an American invasion provoked by the sinking of the battleship "Maine" at the beginning of that very same year.
In the Philippines, the Philippine American War began, but the other islands (Cuba, Puerto Rico) were relatively tranquil. The loss of Cuba and Puerto Rico effectively ended 4 centuries of Spanish colonialism in the Americas.