Villalba y Toledo was a knight of the Order of Santiago and majordomo of Juan José of Austria, son of Spanish King Philip IV.
He traveled to Cartagena de Indias to inspect its defenses after the English pirate Henry Morgan attacked the Castle of San Felipe in 1668.
Because of a shortage of coinage in New Granada, Villalba ordered the silver bars be melted down to make coins of one quarter and one half real.
There was a variety of complaints to the Crown against Villalba's administration, and Bishop Melchor Liñán y Cisneros was appointed visitador (inspector) to investigate them.
On 2 June 1671, Liñán y Cisneros replaced him on a temporary basis as governor and captain general of New Granada.