This was a combination of political rebellion and race war with Padre Hidalgo inciting the most heavily mixed race elements to rise up and kill those of Spanish blood. Huge mobs took to the streets and across New Spain city after city fell into rebel hands. Mexico City fell into a panic as Padre Hidalgo defeated the royalist army and marched toward the capital with 80,000 men. However, at the critical moment, the Padre lost his nerve and ordered a retreat. Calleja del Rey was, at the time, a brigadier general in command of a cavalry division at San Luis Potosi and Viceroy Francisco Javier Venegas summoned him to come to the aid of Mexico City. It was the start of a masterful campaign. Calleja del Rey and his royalist forces first met the rebels on November 7, 1810 on the plains of San Jeronimo Aculco and completely wiped them out. On November 25 his royalist forces re-captured Guanajuato and on January 21, 1811 liberated Guadalajara. The rebels retreated, despite their still swelling ranks, and Calleja del Rey gave chase. On January 17, 1811 at the battle of Calderon bridge, his tiny force of 6,000 royalists attacked and routed an army of 100,000 rebels in a stunning victory that ensured the revolution would be crushed and put off the independence of Mexico for another ten years.
Nonetheless, Calleja del Rey showed himself more than up to this formidable challenge. As the Spanish Inquisition had been abolished by the Constitution of 1812, he alleviated some of the immediate financial problems by confiscating their property in New Spain. Using his meager forces, he reestablished order so that postal service and regular commerce could be resumed, he set up a strict system of financial oversight for the treasury, keeping a close account of all income and expenses, cut out waste and hired a private third party to collect the sales taxes all of which greatly increased revenues. With this he was able to turn his attention to the army and ensure that the military was properly funded, well disciplined, well equipped and promptly paid. It really seemed that a page had been turned in the history of New Spain and that Spanish power in America was on the rise again. Unfortunately, there were some problems totally beyond the control of the new Viceroy. Toward the end of 1813 a massive epidemic broke out that took tens of thousands of lives and that same year the renegade Morelos captured Acapulco and later the Congress of Anahuac declared the independence of Mexico in Guerrero.
No one can long endure against enemies to the front and rear and so it is not surprising that Calleja del Rey was dismissed as Viceroy on September 20, 1816. Still, his magnificent service was not forgotten and when he returned to Spain he was awarded the Grand Cross of the Royal and Military Order of San Hermenegildo and the Royal American Order of Queen Isabella the Catholic as well as being given the title of First Count of Calderon for his stunning victory at Calderon Bridge. The Count of Calderon continued in his career, becoming military commander in Andalucia and governor of Cadiz. However, removing the most gifted general in Mexican service proved not to be a wise move and rebellion and disorder increased in his absence. Soon, he was charged with organizing a new Spanish army to be sent to New Spain to restore royal authority. However, that project was interrupted by unrest at home as liberals in Spain rose up against King Fernando VII in 1820. The Count of Calderon met the crisis with his usual zeal and was able to capture Rafael del Riego, the instigator of the liberal uprising. He joined the list along with Hidalgo, Allende and Morelos of prominent enemies of the Spanish Crown brought to justice by the Count of Calderon. However, that was to be his last major prize before his death in Valencia in 1828.