The 4th Marquis de Avilés, and Viceroy of Peru from 21 May 1801 until July 1806, Gabriel Miguel de Avilés was born in Vic (Barcelona) in 1735. The son of a military man, he trained as a captain in the cavalry and in 1768 moved to Chile to serve as an official instructor, receiving the rank of colonel. In 1781 he was sent to Lima to quell the insurrection led by José Gabriel Tupac Amaru and, years later, following the uprising of 1783, he ordered the execution of Diego Cristóbal Tupac Amaru.
Prior to his appointment as Viceroy of Peru on 21 May 1801, he was governor of Chile and Viceroy of Buenos Aires. He was popularly known as the "devout Viceroy" because of the great attention he devoted to religious matters.
As Viceroy of Peru, he was the ultimate authority for the carrying out of the collection of funds that were demanded by the public purse in Spain: He also put together the squadron to transport them to the Spanish Peninsula, as can be seen in the correspondence he maintained with the Minister of the Treasury, Miguel Cayetano Soler, and the Minister of the Navy, Domingo Pérez de Grandallana.
During his tenure, the government of Maynas was created and Guayaquil was incorporated into the Viceroyalty of Peru. Gabriel Miguel Avilés left his post as Viceroy of Peru in July 1806, and died in Valparaiso in 1810 as he was trying to return to Spain.