Juan Pío de Tristán y Moscoso (in full, Juan Pío de Tristán y Moscoso) (July 11, 1773, Arequipa Peru – August 24, 1860, Lima) was a Peruvian general and politician who served as the second President of South Peru from October 12, 1838 to February 23, 1839. He was nominally the last Spanish viceroy of Peru, serving in that capacity from December 1824 to January 23, 1826, but not exercising power.
Born in Peru, Tristán y Moscoso went to Spain, where he fought the French in the War of the Convention (1793–1795). On his return to Peru he was elected alcalde (mayor) of Arequipa (1808). He was a general in the Royalist army in Peru. In June 1811 he fought as part of the victorious Royalist forces in the Battle of Guaqui.
He led a Royalist force into the territory of present-day Argentina after the Battle of Guaqui. He was defeated at Tucumán and Salta, by one of his classmates at Salamanca, rebel General Manuel Belgrano. The Battle of Salta took place on February 20, 1813. Belgrano had been sent by the Second Triumvirate (of insurgents in Buenos Aires) to attack the city, at the northern extremity of the old Viceroyalty of Rio de la Plata. This he did, completely defeating the troops of Tristán. It was the first military victory achieved under the flag of Argentina.
After his defeat, Tristán signed a 40-day truce and returned to Peru. The defeat of the Royalists at Salta gave the insurgents domination over the northern part of the old viceroyalty and also led to revolts against the Spanish in Charcas, Potosí and later Cochabamba, Alto Perú (now Bolivia). At the expiration of the truce, General Belgrano followed Tristán into Alto Perú, entering the territory of Charcas on May 7, 1813. However, Belgrano was defeated at Vilcapugio on November 1, and again at Ayohuma on November 14.