At least 97 people have been killed as rescuers search through flattened homes, shops and mosques for survivors after a powerful 6.5-magnitude earthquake struck Pidie Jaya district in the Aceh province in Sumatra, Indonesia.

The earthquake struck as Muslims were preparing for their morning prayers. The army has taken over the search and rescue operations, AFP reports.

"So far 97 people have been killed and the number keeps growing," Aceh military chief Tatang Sulaiman told the news agency. "When we retrieve bodies sometimes there's five, sometimes 10 corpses."

More than 1,000 soldiers and about 900 police officers have been sent to the worst-hit areas to help set up shelters and evacuation points, he said.

Hundreds of houses, shops and mosques were flattened by the earthquake, leaving people homeless and in desperate need of basic supplies like food and water, stated officials.

Indonesia earthquake
An earthquake survivor is accompanied by her family at a district hospital in Pidie Jaya Chaideer Mahyuddin/AFP

"The electricity is still off. Some places have generators, but there are not many," Puteh Manaf, the head of the local disaster agency told AFP. "If it rains, there will be disease."

The district health office chief Said Abdullah added that nearly 200 injured people had sought treatment. Many however refused to enter the hospital over fears of aftershocks.

"We are treating people outside. We took the beds out because nobody is daring to enter the hospital," he said.

Indonesia earthquake
People walk near a collapsed mosque following an earthquake in Meuredu, Pidie Jaya in the northern province of Aceh Antara Foto/ Irwansyah Putra/ Reuters

This is the second time in just over a decade that the province has been hit by natural disaster. In 2004, an undersea earthquake triggered a tsunami that engulfed parts of Aceh and other countries around the Indian Ocean, killing more than 170,000 people in Indonesia alone.

The US Geological Survey upgraded the magnitude of the earthquake to 6.5 from an initial reading of 6.4 and issued a yellow alert for expected fatalities and damage.

Aceh lies on the northern tip of the Sumatra island, which is particularly prone to earthquakes.