ANCHORAGE, Alaska — The magnitude 7.0 earthquake that rattled Alaska’s largest city cracked roads and collapsed highway ramps, but there were no reports of widespread catastrophic damage or collapsed buildings.

There’s a good reason for that.

A devastating 1964 Alaska earthquake — the most powerful on record in the United States — led to stricter building codes that helped structures withstand the shifting earth Friday.

“Congratulations to the people of Alaska for being really prepared for this earthquake,” U.S. Geological Survey Geophysicist Paul Caruso said Saturday. “Because a magnitude 7.0 in a city like that, you know, it could have been significantly worse.”

A seismic expert said Alaska and California use the most stringent standards to help buildings withstand earthquakes.

Sterling Strait, a member of the Alaska Seismic Hazards Safety Commission, said the states use the International Building Code, considered the best available standard for seismic safety.

It requires buildings to be designed to resist possible ground motion determined by location and earthquake histories.

It also mandates structural connections — such as beams and columns — be reinforced to resist damage from shaking, said Strait, seismic program coordinator for Alyeska Pipeline Service Co., operator of the 800-mile (1,287-kilometer) Alaska oil pipeline.

Gov. Bill Walker said sometimes people, including himself, grouse about stringent building codes. But he’s “really glad” they were in place as he only had minor water damage at his home.

“Building codes mean something,” he said.

The quake was centered about 7 miles (12 kilometers) north of Anchorage, which has a population of about 300,000. People ran from their offices or took cover under desks. A 5.7 aftershock followed within minutes. Then came a series of smaller quakes.

The two big back-to-back quakes knocked items off shelves, disrupted power, broke store windows and briefly triggered a tsunami warning for islands and coastal areas south of the city. Walker issued a disaster declaration, and President Donald Trump declared an emergency, allowing the Federal Emergency Management Agency to coordinate disaster relief.

There were no reports of deaths or serious injuries.

The oil pipeline was shut down for hours Friday while crews were sent to inspect it for damage. Alyeska spokeswoman Michelle Egan said it was restarted at 3:30 p.m. Friday.

She said Saturday there were no obvious signs of damage and no operational impact on the pipeline. Its closest section is 120 miles (193 kilometers) from the epicenter of the seismic activity.

Aftershocks Saturday continued to fray nerves, with people worrying about being caught in more massive shakers.

“They’re disturbing, and I’m not putting anything away that could fall until they calm down,” Randall Cavanaugh, an Anchorage attorney, said following a restless night at home. “I kept waking up.”

By mid-morning, there had been about 550 aftershocks, including 11 with magnitudes of 4.5 or greater, Caruso said.

The aftershocks should be weaker and less frequent in the coming days, but officials can’t say for sure when they’ll stop, he said.

Anchorage Mayor Ethan Berkowitz said the extent of damage was “relatively small” considering the scale of Friday’s earthquake. He also credited building codes for minimizing structure damage.

“In terms of a disaster, I think it says more about who we are than what we suffered,” he said at a press briefing, adding that Anchorage was prepared for such an emergency.

“People pulled together. We followed the plans that were in place. We looked after one another. And when people around the country and around the world look at this, they’re going to say, ’We want to do things in the Anchorage way because Anchorage did this right,” Berkowitz said.

After the first earthquake, Alaska’s largest hospital activated its incident command center, but the trickle of patients into the emergency room at Providence Alaska Medical Center in Anchorage was like a normal workday.

“It wasn’t a situation where there was a mass rush of people,” hospital spokesman Mikal Canfield said.

Roads didn’t fare so well. The Alaska Department of Transportation counted about 50 sites with damage, including eight considered major. Most of the damage was done to highways north of Anchorage. The agency also was planning to conduct bridge inspections.

Transportation officials said in a release that the aftershocks continue to contribute to settling and additional cracking. Rock falls exacerbated by the aftershocks were causing some problems on the Seward Highway south of Anchorage.

Earthquake damage also was preventing Alaska Railroad trains from making the trek between Anchorage and Fairbanks. The trip is 350 miles (563 kilometers) each way.

Train service south of Anchorage is scheduled to resume Sunday.

Normal operations resumed at Ted Stevens Anchorage International Airport after flight operations were suspended Friday, Transportation Department spokesman Meadow Bailey told The Associated Press.

Anchorage’s school system canceled classes through Tuesday while it examined buildings for damage.

Alaska’s 1964 earthquake, with a 9.2 magnitude, was centered about 75 miles (120 kilometers) east of Anchorage. It and the tsunami it triggered claimed about 130 lives.

The state averages 40,000 earthquakes a year, with more large quakes than the 49 other states combined.

Associated Press writers Becky Bohrer in Juneau, Alaska; Dan Joling in Anchorage; Gillian Flaccus in Portland, Oregon; Gene Johnson in Seattle; Jennifer Kelleher, Audrey McAvoy and Caleb Jones in Honolulu; Rachel La Corte in Olympia, Washington; and John Antczak in Los Angeles contributed to this report.