Actually, anti-Spanish sentiment long preceded the sinking of the Maine, because of Spanish brutality in trying to suppress a rebellion. That was what had the Maine in Havanna harbor. Coverage by Hearst's and Pulitzer's newspapers stirred up Americans' outrage, but the brutalities were real, and Cuba was/is a little over a hundred mile off the Florida coast. At most, the sinking of the Maine was the last straw that made up a 2000-pound load.
The most likely cause of the sinking of the Maine was a magazine explosion due to a spontaneously combusted fire in a coal bunker adjacent to a magazine. One of the problems with coal as a fuel for ships generally was bunker fires. The Maine was designed before this became well known, and coal bunkers were used to shield magazines from enemy shells. While the Maine was considered a second class battleship. she was much out-classed by the contemporary Indiana and Iowa class pre-dreadnought battleships. The Indianas and Iowa seem to have had a better layout, as all four survived to be scrapped, except for the Oregon, which became a museum, briefly, and was eventually scrapped.