0335 GMT June 30, 2022
Monday afternoon's shallow 5.3-magnitude quake jolted Qadis district in Badghis Province, a rural area not easily accessible by road.
"The earthquake caused massive damage to houses, about 700 to 1,000 have been damaged," Badghis provincial spokesman Baz Mohammad Sarwary said in a video message.
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.
Sarwary said 22 people were killed and four were injured, revising the death toll from the previous figure of 26 he gave to AFP late Monday.
"There is the possibility that the casualties could increase," he said in his latest video message.
Taliban government spokesman Zabihullah Mujahid confirmed the toll.
Images circulating on social media showed residents, including children, searching through the rubble of collapsed homes.
Government officials said rescue workers were helping search for survivors and transferring the injured to local hospitals.
A Taliban team was in the area assisting in the relief work.
Mujahid said that all government agencies had been instructed to provide the food, medical aid and shelter to those affected.
"We also call on international aid agencies and humanitarian agencies to assist the victims of the disaster," he said in a statement posted on Twitter.
The epicentre of the quake was near the city of Qala-i-Naw, the capital of Badghis, less than 100 kilometres (60 miles) from the Turkmenistan border, according to the United States Geological Survey.
The United Nations has said it needs $5 billion in 2022 to avert the ongoing humanitarian catastrophe in Afghanistan.
A devastating drought has compounded the crisis, with earthquake-hit Qadis one of the worst affected areas.
Afghanistan is frequently hit by earthquakes, especially in the Hindu Kush mountain range, which lies near the junction of the Eurasian and Indian tectonic plates.
Even weak earthquakes can cause significant damage to poorly built homes and buildings in the impoverished country.
In 2015, more than 380 people were killed in Pakistan and Afghanistan when a powerful 7.5-magnitude earthquake ripped across the two countries, 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.