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 . 12 Products made there include electronics , medicines , foods , cement , plastics , clothes , and furniture . 67 Industrial activity is diverse , ranging from shipbuilding and oil refining to food processing and the manufacture of cement , chemicals , pharmaceuticals , plastics , textiles and clothing , and furniture . 14 People have lived in the Lima area for thousands of years . 129 The area around Lima has been inhabited for thousands of years . 15 Even before the time of the Inca empire , a shrine called Pachacamac was located there . 131 200 BC-AD 600 ) , the most important being Pachacamac , which was an important religious site in both pre-Inca and Inca times . 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 . 22 At the end of the wars , it was one of the last cities to gain independence . 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 . 25 Other railways were soon built between Lima and suburbs such as Miraflores . 143 Interurban railway links to Miraflores , Ancon , and Chosica followed in the next 20 years and provided the opportunity for suburban growth . 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 . 28 The city grew quickly again in the 1920s and 1930s , when highways were built between Lima and other parts of Peru . 149 A new wave of urban expansion in the 1920s and '30s was set off by the automobile and the subsequent road-building program that improved transportation not only within the capital but also between Lima and other parts of the country . 29 Lima became a magnet for people wishing to find better jobs and improve their lives . 150 For the first time , migrants could reach Lima relatively easily , and this rich , powerful , and modernizing centre became a national magnet .