Tsunami alert was sounded off in the area as residents fled for higher ground.
No casualty or damage has been reported so far.
According to the U.S. Geological Survey, the quake occurred at 5:15 a.m. (2215 GMT) and was centered 125 miles (205 kilometers) northwest of Sibolga in Sumatra at a depth of 28.6 miles (46 kilometers).
"So far no damage or casualties have been reported and the situation is under control," Aceh Governor Irwandi Yusuf said.
The meteorology agency reported at least five strong aftershocks measuring up to 5.2.
The quake triggered off panic among the residents, who were getting ready for their morning prayers in North Sumatra's capital. Electricity was disrupted in Medan and Banda Aceh, provincial capital of Aceh.
A brief tsunami warning brought the people in several cities along the southeastern coast of Sumatra as well as Sinabang on Simeulue island and Gunung Sitoli on nearby Nias island into the streets and sent them running for higher grounds.
"Rumors about a tsunami panicked villagers living near the beach. They ran away on motorbikes and cars or by climbing the hills. There was panic and chaos everywhere, but I don't see serious damage or injuries in my village," said Eddy Effendi, a resident in Nias district of North Sumatra province.
According to the residents in Sibolga, the shaking lasted for more than a minute and utility poles in the area were uprooted.
In 2004, the region had experienced a tsunami triggered by a magnitude-9.2 earthquake.