Viceroyalty of Perú

The Viceroyalty of Peru (in Spanish, "Virreinato del Perú") was a Spanish colonial administrative district that was created in 1542 and originally contained most of Spanish-ruled South America. It was governed from the capital of Lima. 
History.
In 1542, the Spanish created the Viceroyalty of New Castilla, that shortly afterwards would be called the Viceroyalty of Peru. In 1544, Holy Roman Emperor Charles V (King Charles I of Spain) named "Blasco Núñez Vela" Peru's first viceroy, but the viceroyalty was not organized until the arrival of Viceroy Francisco de Toledo in 1572. 
Francisco de Toledo, "one of the great administrators of human times", established the Inquisition and created laws that applied to both Indians and Spanish alike. So he broke the power of the encomenderos and reduced the old system of forced native labor. He improved the safety in the viceroyalty with fortifications, bridges and "la Armada del Mar del Sur" (the Southern Fleet) against the pirates. 
The Amazon basin and some large regions nearby had been considered Spanish territory since the Treaty of Tordesillas. But this treaty meant not much during the time Spain controlled Portugal (1580 - 1640). 
The first Jesuit reduction to convert and "civilize" the Indigenous population was founded in 1609, but some areas were occupied by Brazilians as Bandeirantes gradually extended their activities throughout much of the basin and adjoining Matto Grosso in the 17th and 18th centuries. These groups had the advantage of remote geography and river access from the mouth of the Amazon (which was in Portuguese territory) making it impossible for the Spanish authorities to control them. One famous attack upon a Spanish mission in 1628 resulted in the enslavement of 60 000 indigenous people. In fact as time passed they were used as a self funding occupation force by the Portuguese authorities in what was effectively a low level war of territorial conquest. Finally the reality of the situation was recognized with the transfer of sovereignty over the much of the basin and surrounding areas to Portugal in the 1750 Treaty of Madrid.