File Photo: Afghan men prepare a mass grave for the people killed in the earthquake in Afghnistan. AP
The victims died when roofs of their houses collapsed in Qadis district in the western province of Badghis, spokesman for the province Baz Mohammad Sarwary told AFP.
The shallow quake was magnitude 5.3, according to the US Geological Survey.
"Five women and four children are among the 26 people killed in the earthquake," said Sarwary, adding that four more were injured.
The quake also inflicted damage on the residents of Muqr district in the province but details including casualties were still unavailable, he said.
Afghanistan is already in the grip of a humanitarian disaster, worsened by the Taliban takeover of the country in August when Western countries froze international aid and access to assets held abroad.
Qadis is one of the areas worst affected by a devastating drought, benefiting little from international aid in the past 20 years.
The country is frequently hit by earthquakes, especially in the Hindu Kush mountain range, which lies near the junction of the Eurasian and Indian tectonic plates.
Earthquakes can cause significant damage to poorly built homes and buildings in impoverished Afghanistan.
In 2015, nearly 280 people were killed when a powerful 7.5-magnitude earthquake centered in the mountain range ripped across South Asia, with the bulk of the deaths in Pakistan.
In that disaster, 12 young Afghan girls were crushed to death in a stampede as they tried to flee their shaking school building.