The end of the 19th Century found the Spanish Empire in a shambles due to the ongoing independence wars, the loss of the territories in Latin America, and economic hardship. The Spanish-American War was the last struggle of the Spanish Empire to maintain its colonies. The U.S., meanwhile was strengthening its position in North America as one of the newest geopolitical powers.
After defeating Mexico, the U.S. became a significant militaristic power. Historians present multiple arguments about the causes of the Spanish American War. Many believe that the desire for cheap labor, expanding new markets, and accumulating resources were the motivations for the U.S. expansion policy in the late 1800s, which also mirrored in the Manifest Destiny.
The U.S. was cognizant of the risk that another European power might gain control of the two Caribbean islands, Cuba and Puerto Rico. Hence, Cuba had multiple problems domestically including the rise of the nationalistic sentiments and the independence rhetoric led by José Martí.
At the time, Spain did not pose any threat to the United States. Thus, on May 12, 1898, the occupation of Puerto Rico took place. General Nelson Miles left Cuba with 3400 soldiers and 6 ships and headed to Puerto Rico to confront approximately nine thousand Spanish soldiers.
The natives were doubtful that Spain was going to grant the island the autonomous status as promised in 1897. Moreover, Puerto Ricans believed that the U.S. invasion would facilitate transitioning the country to independence and grant them sovereignty. As a result, for the most part of the island, U.S. troops were greeted as liberators.