He inflicted a serious defeat on the Carlist general Miguel Gómez Damas at the Battle of Villarrobledo, which led to his promotion to the rank of general and the earning of the title of Viscount of Villarrobledo, as well as the Cross of Saint Ferdinand. He later served as a senator-for-life, Minister of War, and served as interim president of the Council of Ministers from December 9, 1838 to February 3, 1839 –in effect, serving as head of the Spanish government.
As Minister of War, he signed the Vergara Embrace, which ended the First Carlist War, and thereby earned the title of Count of Vergara.