Indonesian President Joko Widodo pledged Friday to help the people of Aceh rebuild as he toured areas worst-hit by a devastating earthquake that killed more than 100 people and left thousands homeless.

The shallow 6.5-magnitude quake Wednesday levelled hundreds of homes, mosques and businesses across Aceh province, one of the areas worst affected by the destructive 2004 tsunami.

Rescue crews have been searching the rubble with sniffer dogs while excavators clear the debris-strewn streets two days after the disaster.

Humanitarian assistance is reaching the hardest-hit district of Pidie Jaya, where many spent a second night sleeping in shelters and overcrowded field hospitals.

Pope Francis offered his prayers to the victims overnight, urging them strength in their toughest hour.

Widodo, who flew to Aceh Friday, met with victims in hospitals before visiting a local mosque damaged in the quake.

The earthquake struck at dawn as many in the predominantly Muslim region were preparing for prayers.

"We will rebuild this mosque as soon as possible," he told the gathered crowd.

"We'll work through this together."

Among those who gathered to hear Widodo speak was Rahmawati, who lost her husband and two children in the quake.

"I am happy the president is willing to see those of us who are grieving," she told AFP.

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

A huge undersea earthquake in 2004 triggered a tsunami that engulfed several countries around the Indian Ocean, killing more than 170,000 people in Indonesia alone, the vast majority in Aceh.

Many parts of Indonesia experience frequent seismic and volcanic activity due to its position on the Pacific "Ring of Fire", where tectonic plates collide.