Conquistadores under Francisco Pizarro in the name of Spain conquered the Inca Empire in 1532-1533. In 1542 the Viceroyalty of Peru was established, with capital in Lima. In 1550 the Vicereoyalty of New Spain ceded Tierra Firma to the Viceroyalty of Peru.
In 1717 the Viceroyalty of New Granada (Audiencias of Santa Fe de Bogota and Quito) was carved out of the Viceroyalty of Peru; in 1723 the Audiencia of Quito reverted to the Viceroyalty of Peru. In 1739 the Viceroyalty of Peru ceded the Audiencias of Quito and Panama to the
Viceroyalty of New Granada.
In 1776 the Viceroyalty of La Plata was carved out of the Viceroyalty of Peru.
The Treaty of San Ildefonso 1777 resulted in a large chunk of territory, which included most of Amazonia, being ceded to Portugal, enlarging its colony of Brazil.
The Spanish defeat in the Battle of Ayacucho 1824 resulted in the end of the Viceroyalty of Peru. Successor states the Republics of Peru and Bolivia.

The vast extent of the territory claimed by the Viceroyalty is deceiving. Spanish control centered on cities such as Lima, Panama, Cusco, Quito, Bogota, Santiago de Chile, on mining centers such as Potosi, on areas with intensive agriculture. Spanish economic policy regarding the colonies - banning trade with foreigners, granting Lima a privilege which required any (legal) imports first to be offered on her market before being sold anywhere else in the Viceroyalty (abolished only in 1740) resulted in huge areas such as Patagonia, Amazonia, most of Guiana to remain hardly untouched (by the Spaniards), the La Plata region with its huge potential for cultivation, to be long neglected. Spanish reformers of the 18th century realized this and broke up the Viceroyalty.
The reformers also realized that other European colonies in the Americas were economically successful because of slave-based plantations. The Treaty of San Ildefonso was to give Spainaccess to Africa (Portuguese territory according to the Treaty of Tordesillas).

Anon., An account of the Spanish settlements in America, 1762, IA;
pt.I. An account of the discovery of America; with a description of the Spanish insulan colonies in the West Indies.--pt.II. The Spanish settlements on the continent of North America.--pt.III. The Spanish settlements in Peru, Chili, Paraguay, and Rio-de-la-Plata.--pt.IV. The Spanish settlements in Terra Firma. Of the different countries in South America still possessed by the Indians, &c., with a description of the Canary Islands.--Appendix, containing a succinct account of old Spain.--Accounts of the siege and surrender of the Havannah
W. Robertson, The history of America, 1787, GB
Viceroyalty of Peru, pp.75-155 in vol.2 of R.H. Bonnycastle, Spanish America, 1818, GB

Article : Latin American Historiography (excluding Mexico and Brazil) - Writing on the precolonial and colonial periods from the sixteenth century
to the present day, by G.L. Vasquez, pp.534-542,
Article : Latin American Historiography (excluding Mexico and Brazil) - The National Period, 1820-1990, pp.542-545 in vol.2
of A Global Encyclopedia of Historical Writing, NY 1998 [G]