1 The capital and largest city of Peru , Lima is located on the country's Pacific coast , on the western side of South America . 1 city , capital of Peru and of Lima department . 1 The capital and largest city of Peru , Lima is located on the country's Pacific coast , on the western side of South America . 9 With its port of Callao and its location at the centre of Peru's Pacific coast , Lima was long the only point of contact between the nation and the outside world . 4 The historic center of Lima is famous for its colonial buildings , including the Torre Tagle Palace , the 18th-century cathedral , the Archbishop's Palace , the Presidential Palace , and the San Francisco Convent , under which are tombs and catacombs . 29 Bounded on the north by the Rimac and on the east , south , and west by broad avenues , old Lima contains a few restored colonial buildings ( Torre Tagle Palace , the cathedral , and the Archbishop's Palace ) interspersed among buildings of the 19th and 20th centuries , many of which were built upon the sites of former colonial residences that had collapsed during the major earthquakes that have struck the city . 5 Tourists can take tours of several of these buildings and watch the changing of the guard at the Presidential Palace . 32 The Presidential Palace ( built on the site of Pizarro's house ) and many other buildings reflect the past popularity of the French Empire style . 14 People have lived in the Lima area for thousands of years . 129 The area around Lima has been inhabited for thousands of years . 16 It was one of the most important religious sites in the Andes region of South America , and it contained many gold treasures . 111 Within Lima itself are the well-restored burial sites ( huacas ) of the pre-Inca coastal cultures , and south of the city stand the remains of Pachacamac , one of Peru's largest pre-Hispanic religious centres . 17 The Spanish conquistador Francisco Pizarro founded the city of Lima in 1535 . 133 The Spanish city of Lima was founded by Pizarro on January 6 , 1535 , which , being Epiphany , prompted the name Ciudad de los Reyes ( "City of Kings") . 18 It soon became Spain's main port in the region , and it was made the capital of the Viceroyalty of Peru . 134 Although the name never stuck , Lima soon became the capital of the new viceroyalty of Peru , chosen over the old Inca capital of Cuzco to the southeast because the coastal location facilitated communication with Spain . 20 A powerful earthquake struck in 1746 , destroying numerous buildings including the cathedral , which was later rebuilt . 139 The city was devastated by a powerful earthquake in 1746 . 21 In the 1820s , during the wars of independence between Spain and its Latin American colonies , Lima was a Spanish stronghold . 141 Lima maintained its loyalty during the struggles for Latin American independence in the early 19th century , with Peru becoming the last mainland colony to declare its independence from Spain ( July 1821) . 24 A railroad was built between Lima and its port , Callao , in 1851 . 142 Lima's development into a modern city began after the completion of the Lima-Callao railroad in 1851 . 27 The city suffered greatly from 1881 to 1883 , however , when troops from Chile occupied it , stole many of its treasures , and destroyed the National Library . 146 However , Lima's prosperity subsequently declined as political turmoil swept the nation , and , as a result of the disastrous War of the Pacific , the Chilean military looted and occupied the city ( 1881-83 ) , burning the National Library in the process .