ANCHORAGE — The Alaskans, roused by a major earthquake and threatened by the specter of a tsunami, moved in the middle of the night.

They shuffled into schools that had become evacuation centers. They parked their cars on higher ground at Safeway and Walmart stores. They rushed up Pillar Mountain. Then, mercifully, the big waves never came, and within four hours, the authorities lifted the tsunami advisories that had once stretched from Alaska to the American border with Mexico.

“Everybody had to evacuate,” Fran Latham, who runs a bed-and-breakfast in Yakutat, said of her town between Anchorage and Glacier Bay National Park. “It looked like everybody was at the school and the police department.”

The overnight panic along the Pacific began after a magnitude 7.9 quake was reported at 12:31 a.m. local time in the Gulf of Alaska, according to the United States Geological Survey. There were no immediate reports of damage or fatalities, the authorities said, but the United States National Tsunami Warning Center said a small tsunami, with a wave height of less than eight inches, had been observed in a handful of Alaska cities, including Kodiak and Seward.