A friend of Teodoro de Croix, he undertook a long journey in the colonies of South America, knowing the problems and poverty that existed there. In 1740, Fernando VI appointed him ambassador to the Portuguese court, but at the beginning of hostilities between Spain and Portugal (1762), he did not hesitate to take the position of lieutenant of the Spanish Armada under the command of Nicolas de Carvajal: he seized the city of Almeida and was defeated by the troops of the Anglo-Spanish coalition of John Burgoyne and Prince Guillermo de Schamburg-Lippe, in the battle of Valencia.
As Inspector General of Artillery, with the help of Rafael de Sombremonte and Martín de Mayorga, two important officers, he undertook significant military reforms.
Thanks to the influence at the court of Francisco Gil de Taboada, he soon acceded to court circles and was Captain General of Valencia in 1763 and President of the Junta de Castilla and a trusted man of the king, a position almost equivalent to the role of first Minister.
He formed a cabinet of illuminists, composed among others by Agustín de Jáuregui, Joaquín de Montserrat and Juan-Francisco de Güemes, carried out many reforms, including the progressive removal from the court of Antonio Caballero y Góngora and Antonio María de Bucareli y Ursua, leaders of the Jesuits, until their Expulsion from the order in 1767.
He also carried out reforms in the colonies with the help of Manuel Antonio Flores, head of the Spanish Armada.
On the death of Carlos III, he lost his important positions and was ambassador to Paris in 1793.