The United States declared war on Spain in 1898 for a variety of reasons, both political and economic. One of the main factors was the desire to expand American influence overseas and to establish the United States as a major imperial power.
At the time, Spain controlled a number of territories in the Caribbean and the Pacific, including Cuba, Puerto Rico, and the Philippines. American expansionists saw these territories as ripe for the taking, and believed that by annexing them, the United States could extend its influence and increase its power.
Another factor in the decision to declare war was the growing popularity of the "yellow press," or sensationalist newspapers that often sensationalized stories and played up controversial issues in order to boost circulation. The yellow press was particularly critical of Spain's treatment of Cuba, which was then in the midst of a bloody rebellion against Spanish rule. The newspapers helped to whip up public sentiment against Spain, and many Americans came to believe that the United States had a moral obligation to intervene in the conflict.
Finally, the United States had a number of economic incentives for declaring war on Spain. The country was experiencing an economic boom at the time, and many business leaders saw the acquisition of new territories as a way to expand markets and increase profits.
In summary, the United States declared war on Spain in 1898 for a combination of political, moral, and economic reasons. The desire to expand American influence overseas, the influence of the yellow press, and the economic benefits of territorial acquisition all played a role in the decision to go to war.