A magnitude 8.1 earthquake has struck off the coast of Mexico leaving at least five people dead, sparking mass evacuations and prompting warnings of tsunamis across the region.

The quake occurred 165km west of the state of Chiapas just before midnight on Thursday local time, and was said to be the strongest earthquake to hit the country since 1985, according to the civil protection agency.

Three people were confirmed dead in Chiapas, and two in Tabasco state, as the Pacific tsunami warning centre said waves as high as three metres could strike the coast.

The Tabasco governor, Arturo Núñez, said the two killed were children. One died after a wall collapsed and the other was a baby who died in a children’s hospital that lost electricity.

Mexico’s president, Enrique Peña Nieto, said he had asked for updates from the National Disaster Prevention Centre, adding that the authorities were monitoring the situation and would meet immediately to determine their response to the quake.

In a series of tweets, he added that schools would be closed for the day in Mexico City, the state of Mexico, Chiapas, Hidalgo, Veracruz, Guerrero, Tabasco, Oaxaca, Puebla and Tlaxcala. He said the suspension of classed would allow experts to determine the damage to schools.

Rodrigo Soberanes, who lives near San Cristóbal de las Casas in Chiapas, told the Associated Press his house had “moved like chewing gum” in the quake.

The governor of Chiapas, Manuel Velasco, said the roofs of homes and a shopping centre had collapsed in San Cristobal.

“Hospitals have lost energy,” he said. “Homes, schools and hospitals have been affected.”

Reports also suggested that a hotel in the south of the country was among the buildings that suffered severe damage, with rescuers searching for trapped people.

Windows were broken at Mexico City airport and power went out in several neighbourhoods of the capital. The cornice of a hotel collapsed in the southern tourist city of Oaxaca, a witness said.

People in the capital, one of the world’s largest cities, ran out into the streets in pyjamas and alarms sounded after the quake struck just before midnight, a Reuters witness said.

In one central neighbourhood, dozens of people stood outside after the quake, some wrapped in blankets against the cool night air. Children were crying.

Liliana Villa, 35, was in her apartment when the earthquake struck and she fled to the street in her pyjamas.

“It felt horrible, and I thought, ‘this is going to fall’.”

Luis Carlos Briceño, a 31-year-old architect visiting Mexico City, said: “I had never been anywhere where the earth moved so much. At first I laughed, but when the lights went out I didn’t know what to do. I nearly fell over.”

The tremor is possibly the strongest to shake the country since 1985, when a Magnitude 8.0 earthquake levelled large portions of the capital.

Much of Mexico City was built on the soft soil of a former lakebed, leaving it vulnerable to earthquakes.

Patients and doctors of a hospital in Villahermosa in the Mexican state of Tabasco remain in the open air after the earthquake. Photograph: str/EPA

Building codes have been tightened since 1985, while earthquake drills for apartment dwellers and officer workers in Mexico City have become common in recent years.

Public officials were quick to update the public on damage and provide instructions – unlike 1985, when the country’s politicians went missing in action and residents, many left homeless, fended for themselves and teamed up to pull people out of piles of rubble.

Initial waves 1m over tide level were recorded at the Mexican city of Salina Cruzby the Pacific tsunami warning centre. They predicted waves between 0.3 and 1 metres for the Cook Islands, Ecuador, El Salvador, Fiji, French Polynesia, Guatemala and Kiribati.

Waves below 0.3 metres were forecast for countries as far as Australia, Japan and Vietnam.