Peru's Geophysical Institute, or IGP, said the quake occurred at 15:06 local time (20:06 GMT) with its epicenter 29 kilometers (18 miles) north of the San Vicente de Cañete district.
The IGP reported the tremor had a depth of 60 kilometers (37.2 miles) and an intensity of V on the Modified Mercalli scale in Lima and Cañete and IV in Chincha.
Despite the panic unleashed by the major earthquake in Lima, the Peruvian Navy has ruled out the tsunami warning.
According to Civil Defense authorities, there have been no reports of damage or injury so far from the quake.
Earlier today, a magnitude 4 earthquake hit southern Peru about 18 km southwest of Ica's Pisco province, at a depth of 32 km offshore.
Peru is located in an area known as the Pacific Ring of Fire, where about 85 percent of global seismic activity occurs.