Appointed lieutenant in the United States Navy in 1798, he first served in Montezuma in Commodore Truxtun’s squadron in the West Indies during the early part of the naval war with France.
In 1799, he assumed command of the schooner Enterprise in which, during the next year, he captured seven armed French vessels and recaptured several American merchantmen. By the time he was relieved of command due to ill health in October 1800, he had made Enterprise one of the most famous vessels of the Navy.
During the Barbary Wars, Shaw commanded the frigate John Adams in the Mediterranean under Commodore Rodgers from May to November 1804. During the War of 1812, he also commanded the frigate United States.
Captain Shaw died at Philadelphia 17 September 1823.