Chile’s building code sets one hard rule: a new building must not collapse in a magnitude 9.0 earthquake. It may crack. It may tilt. It may even be declared unfit for use afterwards. It must stay standing.

That rule is set to the country’s geology. Chile runs along the boundary between the Nazca and South American plates, which grind past each other by up to 80mm a year. Magnitude 8 quakes come all too often there, and the BBC’s science correspondent Jonathan Amos described the building codes as strict and generally well enforced.

The 2010 test

The code had a hard test in 2010, when a magnitude 8.8 earthquake struck. Felipe Espinoza, a Chilean firefighter, told the Guardian there were 6,000 buildings in the affected area, and only six were seriously damaged.

The quake still killed more than 500 people with the tsunami it set off. The failures that year were in warning rather than building. The monitoring network and the system for alerting people to the coming tsunami both fell short.

What changed after 2010

The government’s response went into sensors and signals. It spent millions upgrading Chile’s network of seismic sensors and improved the telecommunications that carry warnings.

It also drilled people. Ricardo Toro, a former army general who ran Chile’s disaster agency, ONEMI, told the Guardian that its “Chile Prepares” plan ran at least six or seven evacuations of whole regions every year.

Toro had his own reason. He was posted to Port-au-Prince with the UN in 2010 when an earthquake destroyed the city, killing his wife, Maria Teresa Dowling, among more than 200,000 dead. Thousands of Haiti’s buildings, with little or no reinforced concrete, collapsed completely.

The 2015 result

On 16 September 2015 an earthquake the BBC put at magnitude 8.3 struck off the coast of Coquimbo and shook for more than three minutes. One million people left their homes. Waves of up to 4.7 metres hit the coast at Coquimbo.

Thirteen people died, according to the Guardian, which recorded the quake at 8.4. Amos noted that it released five times the energy of the April 2015 earthquake in Nepal, which killed tens of thousands, and that Chile’s toll looked like a fraction of Nepal’s.

Christophe Schmachtel, a UN humanitarian affairs officer, put the difference down to preparation, and said it begins with the building codes. A freelance journalist on the coast, Jane Chambers, gave the view from inside a wooden house on a cliff top. It shook for about three minutes and came through fine, she said, because most of Chile’s buildings are built to withstand tremors.