A powerful 7.9 magnitude earthquake has hit the coast of Peru, killing at least 337 people and injuring hundreds more, Peru's civil defence institute says.
All but one of the deaths were in the coastal province of Ica, about 265km (165 miles) south of the capital, Lima.
In Lima, buildings shook violently during the prolonged tremors, prompting residents to take to the streets.
President Alan Garcia said he was sending three cabinet ministers to the worst affected area.
The earthquake struck at 1841 (2341 GMT) on Wednesday and lasted for several minutes.
The US Geological Survey said the epicentre was beneath the Pacific Ocean, about 145km (90 miles) south-east of Lima. Four strong aftershocks ranging from 5.4 to 5.9 followed, the organisation said.
Rush-hour traffic in Lima came to a halt as buildings shook with the force of the powerful tremors and hundreds of people spilled onto the streets.
"Usually you don't feel a tremor when outside, but the pavement was rippling, so I fled to the park where the ground continued to move under our feet," a resident of Lima, Bronwyn Davis, told the BBC News website.
"What was even more frightening was the roar of the quake coupled with the sky lighting up. It was surreal - if felt like we had stepped onto the set of some war movie."
Berenice, another resident, said the earthquake was the strongest she had ever felt.
"For some it seemed like the end of the world, and most people I know are still nervous," she said.
But the full devastating force of the earthquake was felt closer to the epicentre in the southern coastal province of Ica, where it brought down buildings, cut power supplies and disrupted communications.
Low-lying coastal areas in Peru, Chile, Ecuador and Colombia were evacuated after a tsunami alert was issued, but the warning was later withdrawn.
Deputy Health Minister Jose Calderon described the situation in the city of Ica, where 650,000 people live, as "dramatic".
The National Institute for Civil Defence said 336 people had been killed in the province and 827 others injured. One person was killed in Lima.
TV reports said 17 people were killed and dozens injured when the Senor de Luren church in Ica collapsed during evening mass.
Callers to Radio Programas del Peru (RPP) said many homes in poor neighbourhoods in Ica and nearby Chincha had collapsed and that several cities had no electricity. The town of Pisco, 60km east of the epicentre, was also badly affected.
Hospitals are reported to be overwhelmed by the number of casualties. A cameraman for the Associated Press said the floors of the hospital in Chincha were covered with dead bodies.
The mayor of Ica, Mariano Nacimiento, said he had asked the government for medicine, blankets, tents and all help that could be given. The weather in the region is very cold at the moment.
Rescuers have struggled to reach Ica, however, as parts of the Pan-American Highway have been blocked by huge cracks in the tarmac and fallen power lines.
Unconfirmed reports said a bridge north of the city had collapsed.
State of emergency
President Garcia thanked God that the earthquake had not caused "a catastrophe with an immense number of victims".
In 1970, a 7.9-magnitude earthquake high in the Peruvian Andes triggered a landslide that buried the town of Yungay and killed 66,000 people.
"We have declared a state of emergency in Ica province and we are going this evening to ensure that regional and local governments, civil defence institutions and ministries can spend what they need to, rapidly and immediately," Mr Garcia said.
The president ordered police onto the streets of Lima to keep order, and schools are being closed because the buildings may be unsafe.
In Lima's poorer suburbs and shanty towns, news of the damage is still coming in, reports the BBC's Dan Collyns. However, he says the feeling in the city, where one third of the population lives, is that it may have narrowly avoided a major disaster.
Are you in the Peruvian capital or surrounding areas? Have you felt the effects of the earthquake? Send us your observations.
You can send your pictures and moving footage to firstname.lastname@example.org or text them to 07725 100 100
When taking photos or filming please do not endanger yourself or others, take unnecessary risks or infringe any laws.
The BBC may edit your comments and cannot guarantee that all emails will be published.