On February the 15th, in 1898, The battleship Maine was sunk by the Spanish crown, in Havana Harbor. This was the reason why the United States declared war on Spain in May of the same year.
When the war ended, in December of 1898, Spain had lost all its control over the territories of Puerto Rico, Cuba, The Philippines Islands, and Guam, with some smaller islands as well.
The War ended with the ratification of the Treaty of Paris, that was signed on December 10th, 1898.