Before the war erupted in 1898 Spain was already declining as a world power. Cuba was trying to gain their independence from Spain. This violent conflict caught America’s attention. This conflict was geographically close to the United Stated so they felt the need to help Cuba but America was also well aware that this would benefit them. The sinking of the USS Maine, caused great tension between Spain and America and propaganda and media were switching up the stories blaming Spain for such a violent act when it is possible it was an accident. The tension was building up months before the war.
On April 20, 1898 President McKinley and congress agreed on resolving this issue by demanding Spain to give up control of the island. If Spain failed to do so then military measures would be taken in order to guarantee Cuba’s independence. Spain didn’t agree with these terms and in return President McKinley ordered a naval blockade and announced a call for 125,000 military volunteers. Spain declared war on the United States. John Hay, secretary of state, described this as “a splendid little war” . U.S. Troops including Officer Teddy Roosevelt and the rough riders were sent to Cuba to gain their independence from the Spanish.
https://history.state.gov/milestones/1866-1898/spanish-american-war
My personal opinion on this topic is that America saw an opportunity to gain power and territory that would benefit them economically. Since they had an early economic interest in Asia, this worked out perfectly on their favor as they also gained the Philippines in Southeast Asia from Spain. We will never really know if their intentions were truly just helping Cuba or if it was something else. I don’t take away anything from this “heroic” action because weather they did it for another cause they still helped Cuba gain their independence. I guess you can say it worked out for both sides Cuba and the United States.