In the final campaign that led to the capture of Lima, he participated in the battles of Chorrillos and Miraflores (January 1881), in which he led first a brigade (as colonel) and afterwards a division under General Baquedano. His services at the battle of Chorrillos led to his appointment as Supreme Military and Political Commandant of Peru in 1881.