A quake of 8.2 magnitude has struck off northern Chile, triggering a tsunami alert and killing at least five people.
The US Geological Survey said the quake struck at 20:46 local time (23:46 GMT) about 86km (52 miles) north-west of the mining area of Iquique.
Waves of up to 2.1m (6ft) have hit some areas in Chile, and there have been power cuts, fires and landslides.
Tens of thousands of people were evacuated in affected areas, where a state of emergency has been declared.
Chilean TV broadcast pictures of traffic jams as people tried to leave.
Officials said the dead included people who were crushed by collapsing walls or died of heart attacks.
Iquique Governor Gonzalo Prieto told local media that in addition to those killed, several people had been seriously injured.
While the government said it had no reports of significant damage to coastal areas, a number of adobe homes were reported destroyed in Arica.
Further damage may not be known until dawn. The tsunami warning in Chile will last at least until 08:00 GMT.
The quake shook modern buildings in Peru and in Bolivia’s high altitude capital of La Paz – more than 470km (290 miles) from Iquique.
At least eight strong aftershocks followed in the few hours after the quake, including a 6.2 tremor.
The Chilean interior ministry told the BBC that one of the main roads outside Iquique was cut off because of hillside debris.
The ministry says that partial landslides have also taken place between the towns of Putre and General Lagos.
The interior minister also told Chilean TV that some 300 women inmates had escaped from a prison in Iquique. The authorities are reported to have deployed a planeload of special forces to guard against looting.
Chilean Interior Minister Rodrigo Penailillo said President Michelle Bachelet was being kept informed. She is to travel to the affected area.
“We have taken action to ensure public order in the case of Iquique, where we’ve had a massive escape of more than 300 female prisoners, so that the armed forces and police can coordinate and provide security to the residents,” he said.
‘A big one’
The Pacific Tsunami Warning Center (TWC) issued an initial warning for Chile, Peru, Ecuador, Colombia and Panama.
However, all warnings, watches and alerts were later lifted except for Chile and Peru.
Tsunami watches – in which the danger of tidal waves is deemed to be less serious – had been in place for Costa Rica, Nicaragua, El Salvador, Guatemala, Mexico and Honduras.
“Everyone along our coast should be alert and ready,” Ecuadoran President Rafael Correa said on Twitter.
Ecuador later reduced its alert but maintained a high level of vigilance for the Galapagos Islands.
High waves hit parts of the Chilean coast within 45 minutes of the quake. Pisagua, Patache and Iquique all saw big waves.
“We have asked citizens to evacuate the entire coast,” Chilean home office minister Mahmud Aleuy said.
Evacuations were also ordered in Peru, where waves 2m (6.5ft) above normal forced about 200 people to leave the seaside town of Boca del Rio near the Chilean border, police said.
A British expatriate near the northern Chilean city of Antofagasta told the BBC that there had been several tremors since the last quarter of last year.
“But this earthquake, even with the increased distance, seemed to last a lot longer,” Patrick Moore said.
“I was just sitting on my bed and normally these tremors using last at the very longest about 40 seconds – this one felt like it lasted about two minutes.
“I knew it was bad so I immediately went online to see what had happened and saw a tsunami warning that’s been put in place which confirmed my fears that it was a big one.”
Kurt Hertrampf, a hostel owner in Arica, told the BBC there was a big blackout in the town after the quake and he was surprised the telephone line was still working. He added: “Downtown looks like a ghost town.”
The area close to the epicentre is mineral rich, but none of the major copper companies reported any break in production.
Chile is one of the most seismically active countries in the world.
Central and southern areas of the country were hit by a powerful earthquake of 8.8 magnitude quake followed by a tsunami that devastated scores of towns in February 2010.
In 1960 an area of Chile south of Concepcion was hit by a 9.5 magnitude which caused about 1,655 deaths and a tsunami in Hawaii and Japan.
The 9.0 magnitude quake that struck Japan on 11 March 2011 caused a devastating tsunami and left more than 15,000 people dead, with more than 3,200 missing.