Anthony Esposito and Rosalba O'Brien, Reuters

SANTIAGO - A major earthquake of magnitude 8.2 struck off the coast of northern Chile on Tuesday, causing five deaths and triggering a tsunami that pounded the shore with 2-metre-tall waves.

Officials said the dead included people who were crushed by collapsing walls or were killed by heart attacks.

The government evacuated Chile's northern coast and President Michelle Bachelet declared the area a disaster zone, promising troops and police reinforcements to maintain public order while damage was repaired after landslides blocked roads.

"We're leaving with the children and what we can, but everything is clogged up by people fleeing buildings by the beach," said 32-year old Liliana Arriaza, who was driving away with her three children.

The U.S. Geological Survey said the quake was shallow at 12.5 miles below the seabed and struck about 100 km northwest of the mining port of Iquique near the Peruvian border.

Mining in the world's No. 1 copper producer did not appear significantly interrupted, but about 300 prisoners took advantage of the emergency and escaped from a female penitentiary in Iquique.

About 26 of the women were soon recaptured, authorities said, while security forces fanned out through the area amid reports of power outages and isolated looting.

Photos showed Chileans calmly evacuating coastal areas on foot, with policemen helping bundled-up elderly people and some residents loading up vehicles with their belongings.

Some schools were being used to shelter people, and classes were cancelled in most of the country on Wednesday. LATAM Airlines said it had cancelled some flights to and from Antofagasta, Iquique and Arica in northern Chile.

The Pacific Tsunami Warning Center said the quake generated a large tsunami with the biggest wave reported at about 2 metres. The Chilean navy said the first big wave hit the coast within 45 minutes. Early on Wednesday Chilean authorities cancelled their tsunami warning for most coastal areas.

Iquique is a key port, close to Chile's main copper mines. The area has been on high alert in recent weeks after an unusual number of tremors, and a series of aftershocks further frayed nerves in the early hours of Wednesday.

The city is more than 1,500 km north of Chile's capital Santiago, where the quake was not felt.

Seismic Chile has strict tremor-proof construction regulations and most residents stay calm during quakes, which helps to limit harm.

Lauding Chile's initial response to the quake, President Bachelet said in a televised address: "The government will work for as long as necessary to confront this emergency."

The centre-left president, who only returned to power last month, was due to travel to the north on Wednesday morning.

In 2010, at the end of Bachelet's first term as president, an 8.8-magnitude quake triggered a tsunami that devastated several coastal towns in central-south Chile, a disaster that killed 526 people.

State-owned miner Codelco and other major copper companies reported no harm to workers or mines and said operations in northern Chile were normal. Still, the massive Collahuasi mine evacuated workers so they could be with their families.

A tsunami warning was issued for the Pacific coast of Mexico through Central and South America.

"An earthquake of this size has the potential to generate a destructive tsunami that can strike coastlines near the epicentre within minutes and more distant coastlines within hours," the Pacific Tsunami Warning Center said.

A tsunami advisory was issued for Hawaii, although no disaster was expected to hit the island state.

"Sea level changes and strong currents may occur along all coasts that could be a hazard to swimmers and boaters as well as to persons near the shore at beaches and in harbours and marinas," the warning centre said.

Authorities in Peru started evacuating communities in the southern coastal region of Ica. Electricity was partially lost in the Peruvian cities of Tacna, Moquegua and Arequipa but there were no reports of deaths or serious damage there.

Nearly 11,000 miles northwest of Chile across the ocean, Japan's Meteorological Agency said a tsunami of up to one metre high might hit Japan's Pacific coast at about 5 a.m. on Thursday. After collecting more data, it said it may issue a tsunami advisory early on Thursday.