When Spain declared war on Britain, Gálvez took to the field to defeat the British forces along the Gulf Coast.
On September 7, 1779, he won the battle at Fort Bute on Bayou Manchac, and on September 21, 1779, he captured the British fort at Baton Rouge, as well as Fort Panmure in Natchez. These actions denied the British the ability to supply their forts on the upper Mississippi, which allowed General Clark to defeat those forces.
Gálvez next captured Fort Charlotte in Mobile, and then moved to the most important objective, the British stronghold of Pensacola. Gálvez commanded his own warship, the Gálveztown, thus allowing other ships to enter the bay. The battle was won on May 10, 1781, when the British surrendered more than 4,000 troops.
Knowing that a reliable supply of food was important in the field, he arranged for cattle from the herds of San Antonio to be sent. As many as 15,000 cattle were delivered to feed the Spanish army and its allies from 1779 to 1782
In 1785 Gálvez became Viceroy of New Spain. He died in Mexico City on November 30, 1786 and is buried in the San Fernando Cathedral.
On December 16, 2014, the United States Congress conferred honorary citizenship on Gálvez, citing him as a “hero of the Revolutionary War who risked his life for the freedom of the United States people and provided supplies, intelligence, and strong military support to the war effort.”