He was born at Granada on 6 July 1814, the son of Colonel Pavía, and after a few years at the Jesuit school in Valencia he entered the Royal Artillery Academy at Segovia.
In 1833 he became a lieutenant in the guards of Queen Isabella II, and during the Carlist War from 1833 to 1840 he became general of division in the latter year at the early age of twenty-six.
The Moderate party made him war minister in 1847 and sent him to Catalonia, where his efforts to put down a Carlist rising were not attended with success.
He volunteered to crush the insurrection in Madrid on 22 June 1866, and when the revolution broke out in September 1868 accepted the command of Queen Isabella's troops.
After the coup of December 1874 restored the liberal monarchy, Pavía went to meet Alfonso XII of Spain when the king landed at Valencia in January 1875.