According to the US Geological Survey, the earthquake hit just offshore northern Sumatra (19 km from the town Sigli) at 05:03 local time (22:03 UTC) December 7 at a depth of 17.2 km, Joinfo.com reports.
No tsunami alert was issued.
Many buildings collapsed and people fled homes in the small town of Meureudu.
The head of the local disaster agency, Puteh Manaf, said the sole hospital in the district had been overwhelmed by the number of injured, Asia News reports.
“The data we have now is that 25 people have been killed and hundreds are estimated to have suffered injuries,” he told AFP.
Local district secretary Iskandar Ali also confirmed the figure, citing preliminary data that showed at least 25 had died in the quake.
Rescue operations were under way to find those believed trapped beneath the rubble, with heavy machinery being used to shift the debris.
A witness said local residents were wandering the streets, unable to return to their damaged homes and fearing aftershocks.
At least five aftershocks followed the quake, said Eridawati, local head of the Meteorology, Climatology and Geophysics Agency.
Seismologists said the earthquake was felt across much of Aceh province, which was devastated by the 2004 Indian Ocean tsunami.
The region suffered massive destruction in 2004 when a quake of magnitude 9.2 triggered a tsunami that wiped out entire communities in Indonesia and other countries around the Indian Ocean.
Indonesia was the hardest hit, with more than 120,000 people killed in Aceh alone.
Photo: Chaindeer Mahyuddin/AFP.