Revolts against Spanish rule had occurred for some years in Cuba. There had been war scares before, as in the Virginius Affair in 1873. In the late 1890's, American public opinion was agitated by anti-Spanish propaganda led by journalists such as Joseph Pulitzer and William Hearst which used yellow journalism to criticize Spanish administration of Cuba. After the mysterious sinking of the American battleship Maine in Havana harbor, political pressures from the Democratic Party and certain industrialists pushed the administration of Republican President William McKinley into a war he had wished to avoid. Compromise was sought by Spain, but rejected by the United States which sent an ultimatum to Spain demanding it surrender control of Cuba. First Madrid, then Washington, formally declared war.
Whilst many in both Washington and Madrid hoped for a swift conclusion to the war, many of the Spanish generals were persistent in the defence of the colonies. This resulted in prolonging a war which had, by many perspectives, finished when the Americans invaded and occupied Cuba. Guerrilla war tactics on the Spanish side saw more deaths caused by disease on both sides as the war dragged on, and by 1899, both nations were already war-weary. The result was the 1899 Treaty of Paris, negotiated on terms favourable to the Americans. The Spanish lost their Caribbean holdings (Puerto Rico and Cuba) as well as their largest Pacific holding (the Philippines). This caused a massive blow to the Spanish populations psyche, and as a result, many began to re-evaluate their nations society, and where it was headed. This was movement was dubbed the generation of '99.