Shah Mohammad Khan, a villager in Nangarhar's Sherzad district, told the
Associated Press news agency that the death toll could be even higher.
Khan said that at least 40 people had died, but officials did not confirm his figure.
Residents of Mir Gadkhel, a village about 45km west of the Afghan city of Jalalabad, said they believed that dozens had been killed there.
"Three of my family members were killed and seven are injured. I think about 40 people have died," Gul Mohammad, a villager, said.
Ahmad Shekib Hamraz, an official with the disaster management directorate, said many houses were razed by the quake.
"The centre of the earthquake is located 45km from affected Sherzad district. 100 houses were destroyed. Some 350 to 400 animals were also killed," he said.
Jessica Barry of the International Committee of the Red Cross told Al Jazeera that those left homeless had congregated in an open area and are in need of assistance.
"The Red Crescent is sending tents, blankets and tarpaulins so that by tonight [those people] will have some shelter," she said.
"This is a very rural and remote area. The houses are made of brick and mud and there has been torrential rain in recent days. It's possible that the houses were a little more fragile because of the rain and that may have contributed to [some houses'] collapse."
Todd Baer, Al Jazeera's correspondent reporting from Kabul, said that rescuers heading to the scene of the earthquake were mindful of the threat from Taliban fighters.
"Rescue teams are on the way to help but they have big concerns about security because of the presence of Taliban fighters in the area," he said.
Northern Afghanistan and Pakistan are frequently hit by earthquakes, especially around the Hindu Kush range near the collision of the Eurasian and Indian tectonic plates.
A 7.6-magnitude earthquake in northwest Pakistan and Kashmir in October 2005 killed 74,000 people and displaced 3.5 million.