Bernardo de Gálvez was born on July 23, 1746, in Macharaviaya, a mountain village in the province of Málaga, Spain, the son of Matías and Josepha Madrid y Gallardo de Gálvez. During his lifetime his family was one of the most distinguished in the royal service of Spain. Following family tradition, Bernardo chose a military career. In 1762 he served as a lieutenant in a war with Portugal, after which he was promoted to captain in the Regiment of La Coruña. He arrived in New Spain for the first time as a part of the entourage of his uncle, José de Gálvez Gallardo, who undertook an inspection tour of the viceroyalty of New Spain. In 1769 Gálvez was commissioned to go to the northern frontier of New Spain, where he soon became commandant of military forces in Nueva Vizcaya and Sonora. He led several major expeditions against Apaches, whose depredations seriously crippled the economy of the region. During campaigns along the Pecos and Gila rivers in 1770–71, he was wounded twice but gained military experience that proved invaluable a few years later. The name Paso de Gálvez was given to a crossing on the Pecos River where Gálvez led his troops to victory in a fight with the Apaches (see GÁLVEZ CROSSINGS ON THE PECOS RIVER).
Gálvez returned to Spain in 1772 and spent the next three years in France, where he enrolled in the Regiment of Cantabria to perfect himself in military science and learned the French language and culture. In 1775 he returned to Spain and was assigned to the Regiment of Seville. As captain of infantry under Alejandro O'Reilly, he participated in a failed attack on Algiers and suffered another wound. In recompense, he was promoted to the rank of lieutenant colonel and attached to the Military School of Ávila. In 1776 he was transferred to the faraway province of Louisiana and promoted to colonel of the Louisiana Regiment. On January 1, 1777, he succeeded Luis de Unzaga as governor of Louisiana.
Before Spain entered the American Revolutionary War, Gálvez did much to aid the American patriots. He corresponded directly with Patrick Henry, Thomas Jefferson, and Charles Henry Lee, personally received their emissaries, Oliver Pollock and Capt. George Gibson, and responded to their pleas by securing the port of New Orleans so that only American, Spanish, and French ships could move up and down the Mississippi River. Over the river, a veritable lifeline, great amounts of arms, ammunition, military supplies, and money were delivered to the embattled American forces under George Washington and George Rogers Clark. Spain formally declared war against Great Britain on June 21, 1779, and King Carlos III commissioned Gálvez to raise a force of men and conduct a campaign against the British along the Mississippi River and the Gulf Coast. In order to feed his troops, Gálvez sent an emissary, Francisco García, with a letter to Texas governor Domingo Cabello y Robles requesting the delivery of Texas cattle to Spanish forces in Louisiana. Accordingly, between 1779 and 1782, cattle were purchased from ranches belonging to citizens and missions of Bexar and La Bahía. From Presidio La Bahía, the assembly point, Texas rancheros and their vaqueros trailed these herds to Nacogdoches, Natchitoches, and Opelousas for distribution to Gálvez's forces. Providing escorts for these herds were soldiers from Presidio San Antonio de Béxar, Presidio La Bahía, and El Fuerte del Cíbolo, and several hundred horses were also sent along for artillery and cavalry purposes. Fueled in part by Texas beef, Gálvez, with 1,400 men, took to the field in the fall of 1779 and defeated the British in minor engagements at Manchac, Baton Rouge, and Natchez. On March 14, 1780, after a month-long siege with land and sea forces, Gálvez, with over 2,000 men, captured the British stronghold of Fort Charlotte at Mobile. The climax of the Gulf Coast campaign occurred the following year when Gálvez directed a joint land-sea attack on Pensacola, the British capital of West Florida. He commanded more than 7,000 men in the two-month siege of Fort George in Pensacola before its capture on May 10, 1781. On May 8, 1782, Gálvez and his Spanish forces captured the British naval base at New Providence in the Bahamas. He was busy preparing for a grand campaign against Jamaica when peace negotiations ended the war. After the fighting, Gálvez helped draft the terms of treaty that ended the war, and he was cited by the American Congress for his aid during the conflict.
After the peace accords in April 1783, General Gálvez, accompanied by his wife, the former Marie Felice de Saint-Maxent Estrehan of New Orleans, and two infant children, returned to Spain for a brief rest. In October 1784 he was recalled to America to serve as captain-general and governor of Cuba. Early in 1785 he was appointed viceroy of New Spain to succeed his father, who had died on November 3, 1784. Gálvez and his family moved to Mexico City, which was in the throes of famine and disease. He became endeared to the people of Mexico City by opening up not only the resources of the government but also his personal fortune to help the populace through the difficult times. Two of his main achievements as viceroy were the start of the reconstruction of the Castle of Chapultepec, today a showplace for the Mexican nation, and the completion of the Cathedral of Mexico, the largest cathedral in the western hemisphere.
Gálvez died of an illness on November 30, 1786. His body was buried next to his father's crypt in the wall of the Church of San Fernando. His heart was placed in an urn and reposed in the Cathedral of Mexico. On December 12, eight days after his funeral, his widow gave birth to another child. In 1778 San Bernardo, a Taovayan village on the Red River, was named in honor of Gálvez, then the governor of Louisiana. While he was viceroy of New Spain Gálvez ordered José de Evia's survey of the Gulf Coast; the mapmaker named the biggest bay on the Texas coast Bahía de Galvezton, a name later altered to Galveston. On November 30, 1986, forty members of the orders of the Granaderos and Damas de Gálvez from Texas, in conjunction with the Sociedad Mexicana de Amigos de España, placed a bronze plaque on Gálvez's crypt to honor the life and deeds of this great Spanish hero of the American Revolution.