Lavalle was born at Lima into a prominent family. His father was the soldier and politician Juan Bautista de Lavalle y Zugasti, son of the 1st Count of Premio Real and he himself Count of San Antonio de Vista Alegre, who decided to remain in Peru after the War of Independence and was later Interim President of the Republic. His mother was the youngest daughter of the 1st Count of Casa Saavedra.