Peru emerged shattered from the War of the Pacific (1879-1884), which had cost it its nitrate-rich southern provinces and left the state bankrupt and occupied. Recovery came under the Civilista Party, the party of Lima's merchants, planters, and bankers. In 1889 the government signed the Grace Contract, settling the foreign debt by handing the railways and vast guano and land concessions to the bondholders' Peruvian Corporation. In 1895 Nicolas de Pierola overthrew the military ruler Andres Avelino Caceres and inaugurated the Aristocratic Republic, two decades of rule by the coastal oligarchy.
The Aristocratic Republic rested on exports and order. Sugar and cotton plantations on the coast, worked by wage laborers including Chinese and Japanese immigrants, supplied the world market. In the mountains, foreign capital returned to mining: in 1901 American investors founded the Cerro de Pasco Copper Corporation, which built smelters and railways and made copper a pillar of the economy. Lima was beautified with avenues and parks, and successive Civilista presidents managed the state in the interest of the forty families, as critics called the great fortunes who dominated finance, land, and politics. Elections were controlled, and the Indigenous majority of the highlands had neither vote nor voice.
Beneath the surface calm, pressures accumulated. Workers on the sugar estates and in the mines organized and struck; an eight-hour-day movement swept Lima and Callao in 1913. President Guillermo Billinghurst, a populist millionaire elected in 1912, tried to court the workers and clash with congress, but the oligarchy and the army deposed him in 1914. The First World War first disrupted, then enriched the export economy. And in 1919 a new figure seized power: Augusto B. Leguia, a former president and businessman, who took office through a coup and began a new period of authoritarian rule.
Leguia's early years promised modernization. With loans and contracts from American banks, he launched roads, irrigation, and public works, celebrated the centenary of independence in 1921, and patronized a new constitution in 1920. He also flirted with the new currents of the time: the university reform movement, the indigenista writers demanding justice for the highlands, and organized labor. But he ruled through repression, exiling opponents and muzzling the press, and his debt-fueled spending enriched a narrow circle. By 1924, when exiled students founded the APRA movement abroad, the oligarchic order the Aristocratic Republic had built was entering its final act.