Two historical trains ran into each other in Cuba, culminating in the near destruction of Spain as a world power, from which the nation has never recovered. On one hand, the U.S. had only recently completed total union of the nation under the banner of Manifest Destiny, wherein most citizens saw the rise to the world stage of the still fledgling U.S as inevitable. This move was aided and abetted by powerful and self serving forces in the country that bullied the weak President McKinley into making unforutnate choices.
The second train on a converging track was the continued diminuiation of the once huge Spanish Empire. Beginning with the defeat of the Spanish Armada by ya'll and the loss of Mexico, Peru and Chile, Spain continued to treat the citizens of Cuba with typical Spanish emprical disdain. The term Concentration Camp was coined in Cuba by the Spanish)
William Randolph Hearst and his newspaper publishing empire inflamed the American populace (remember, no TV, radio or internet) with lurid tales, mostly untrue or at least exaggerated, of Spanish mistreatment of the Cubans, and the Spanish attempt to quell the Cuban civil war.
At any rate, McKinley moved part of the U.S. naval fleet into Havana harbor, and, inexplicably, the battleship U.S.S. Maine blew up (still unexplained satisfactorily to this day) precipitating the actual conflict.
The U.S. gained, as you've mentioned. Puerto Rico, the Phillipines (the residents of which didn't want to be the subjects of an American Empire anymore than they had the Spaniards.) Guam was also obtained; Cuba, however was granted independance, but with many restrictions on trade, but not Hawaii, although the U.S. acqusitions of the Spanish American War hastened the annexation of Hawaii as a mid-Pacific base prompted by the usurption of Guam and the Phillipines...