Following duty on the steam frigate Colorado with the European Squadron, another tour as instructor at the Naval Academy, and in the Bureau of Navigation of the Navy Department, he served in the screw sloop Congress.
He was promoted to captain on April 9, 1889, reported to the Mare Island Navy Yard to fit out the protected cruiser San Francisco, and assumed command when she was commissioned on November 15, 1889.
The United States declared war against Spain on April 25, 1898; and, eight days later, Admiral Pascual Cervera's fleet sailed from the Cape Verde Islands for an uncertain destination.
Sampson's early involvement in the conflict included his supervision of the Cuban blockade, which lasted for the duration of the war, as well as the bombardment of the city of San Juan on May 12, 1898.
Awaiting further information on Cervera's whereabouts, Sampson sailed east to San Juan and carried out a bombardment on May 12 that lasted several hours, dealing minor infrastructural damage to the city.
After this preliminary bombardment, Sampson helped lead a land-sea attack on San Juan Hill, along with General William Shafter, taking the city of Santiago de Cuba.
While Sampson also arguably played a significant role in the victory, having laid down the strategic framework and determining the favorable positions of his own forces, it was of course Schley who had actually commanded the fleet during the battle.
After the Battle of Santiago Bay, Sampson was appointed Cuban Commissioner on August 20, 1898, but resumed command of the North Atlantic Fleet in December.