Matías de Gálvez y Gallardo was born in Macharaviaya, a small village in the Spanish region of Andalusia near Málaga.
He rose in rank to general, and because of his military record and the influence of his brother, José de Gálvez, an important administrator in New Spain, he became well known at Court.
Sealed instructions from the Crown intended to be opened in the event of the death of Viceroy Antonio María de Bucareli y Ursúa specified that he be succeeded by the captain general of Guatemala.
Matías de Gálvez was named captain general, governor and president of the Audiencia of Guatemala in April 1779, just before Viceroy Bucareli died.
When Spain entered the American Revolutionary War as an opponent of Great Britain in 1779, he became involved in defending the colony against British incursions.
Because of the distance and the scarcity of resources, the military of New Spain was not able to aid Fort San Juan in Nicaragua, which was captured by a British expedition led by Horatio Nelson.
During his brief administration, he worked to clean the waterways and drain the lake surround Mexico City, built bridges and a sewage system, and paved the streets of La Palma, Monterilla and San Francisco with cobblestones.
On November 13, 1783 he granted permission to Manuel Antonio Valdés Murguía y Saldaña to restart the newspaper La Gaceta de México.
There were no sealed instructions to be opened on the event of his death, and the Audiencia turned over the administration to Vicente Herrera until the arrival of a new viceroy.