Mexico City shook Tuesday, hit by an earthquake that has killed dozens of people, severely damaged buildings and sparked widespread alarm.

It was the second major earthquake in Mexico in just two weeks. On Sept. 7, an 8.1-magnitude temblor struck off Mexico's southern coast. Authorities called that the largest earthquake in the country in 100 years, and the death toll was nearly 100.

Mexico has a long history of earthquakes. In many ways, the country is shaped by them. Data from the U.S. Geological Survey documents more than 40 quakes in Mexico or just offshore with a magnitude of more than 7 in the past century and four with a magnitude above 8.

Coincidentally, Tuesday's earthquake occurred on the anniversary of an 8-magnitude quake in 1985 that hit off the coast of Michoacan state. That temblor caused chaos in Mexico City, with a death toll ranging from 5,000 to 40,000 and thousands of buildings severely damaged.

The 1985 earthquake sparked major political change in the country. Many people were incensed by the lackluster response of the long-ruling Institutional Revolutionary Party (PRI), and real political opposition formed to challenge Mexico's entrenched one-party system, ultimately leading to the PRI's ouster in 2000.

There have also been earthquakes of greater magnitudes: One quake in 1787 had an estimated magnitude of 8.6 and caused a tsunami along 310 miles of the coast that swamped areas as far as 3.7 miles inland, though it produced few deaths in what were then sparsely populated locations.

Mexico is particularly vulnerable to earthquakes: The country is in a region where a number of tectonic plates butt up against one another, with huge amounts of energy waiting to be unleashed. The epicenter of Tuesday's quake was near where two plates — the Cocos and the North American — collide. The USGS notes that within 155 miles of this area, there have been eight other earthquakes with a magnitude higher than 7.

Mexico City is also unusually vulnerable to earthquakes. A 2008 blog post by Horst Rademacher of Berkeley's Seismological Lab explains how the problem goes back to the Aztecs, who founded their capital, Tenochtitlan, on an artificial island in the middle of a shallow lake in the region's central plateau. The lake was later drained and the city became Mexico City, but the vulnerability of the site to earthquakes remained.

“A lake bed in a basin … is one of the worst grounds for constructing a building,” Rademacher wrote. “While hard rock simply shakes with the same frequency and amplitude as seismic waves, the unconsolidated sediments of an ancient lake bed react differently: They can amplify the shaking and even worse, they can lose their consistency and become a liquid.”

The 1985 quake made obvious the risks posed by this factor, as many buildings simply collapsed as the ground shifted beneath them — despite the fact that the earthquake was centered more than 200 miles away.

The Mexican capital has implemented a variety of measures since the 1985 quake to try to limit potential damage, including a seismic sensor system, warning sirens and significant changes to building codes to strengthen new structures.

Read more:

Massive earthquake strikes off Mexico coast, bringing death and tsunami warnings