When forces under his command in the second Carlist War captured Estella, he was named Marquess of Estella.
He was the Spanish Governor-General of the Philippines from 1880 to 1883.
In 1897, he again became the Spanish Governor-General of the Philippines.
He temporarily suspended hostilities in the Philippine Revolution through negotiations with Emilio Aguinaldo in the Pact of Biak-na-Bato and acted briefly as Governor-General of the Philippines.
He was a Minister and the 70th Prime Minister of Spain for one day between 30 and 31 December 1874.
He was created the 1st Marquess of Estella on 25 May 1877, the 1,124th Knight of the Spanish Order of the Golden Fleece and the 287th Grand Cross of the Royal Order of Our Lady of the Concepcion of Vila Viçosa of Portugal in 1879.
He was married in Sevilla on 18 June 1857 to MarĂa del Pilar Arias-Quiroga y Escalera (Sevilla, Alcolea del RĂo, c.
1835 – 10 May 1894), 745th Dame of the Royal Order of Queen MarĂa Luisa, daughter of Juan Arias-Quiroga y MejĂas, 7th Marquess of Arias-Quiroga and his wife MarĂa Manuela de Escalera y Fernández de Peñaranda, daughter of Roberto de Escalera y Fernandez de Peñarada, 46th Lord of Peñaranda, by whom he had no issue.
He was also the uncle of Miguel Primo de Rivera, the Spanish dictator.