Yellow journalism contributed to the march to war with Spain by dramatizing the plight of Cubans during their war for independence with that country. The phrase is generally associated with journalists working for publishers William Randolph Hearst (the New York Journal) and Joseph Pulitzer (the New York World). These publishers, locked in a struggle for readers, sent reporters to Cuba to cover the fighting there. Acting partially on instructions from the publishers, the reporters and artists (including famous painter and sculptor Frederick Remington) described, in maudlin terms, the suffering of Cuban civilians, especially women and children. The blame for the atrocities they described was laid squarely at the feet of the Spanish occupiers, especially General Valeriano Weyler, who they portrayed as a murderous beast.
When the USS Maine exploded in Havana harbor under mysterious circumstances, yellow journalists quickly reported that the disaster was the work of Spanish saboteurs (we know now that it almost certainly was an accident). In short, the yellow journalists helped to swing American public opinion in favor of war with Spain, which came in 1898. So the yellow journalists didn't cause the war, but they helped build support for it, at least among their readers.