The War of 1898, better known as the Spanish-American War, was caused by a variety of factors. They can be boiled down, however, to two main factors and a catalyst.
The first factor was an American desire to test itself and become a world power. People such as Theodore Roosevelt (not yet president at that point) believed that the US needed to assert itself in world affairs. They believed that a war would actually be a good thing to test American resolve and to show American strength. This led many to be enthusiastic about the prospect of war.
The second factor was the American love of underdogs and anti-colonial movements. Many Americans were sincerely moved by the plight of Cuba. They wanted Cuba to be able to be free from Spanish domination just as the US had once become free from England.
These factors were both encouraged by "yellow journalists." These writers pushed Americans to be more enthusiastic both about the prospect of war in general and in rescuing Cuba from Spain. When the USS Maine blew up in Havana (the catalyst), the US had a reason that could be used to justify war.