The attack in Almar district of Faryab province, bordering Turkmenistan, highlights the heavy toll of such attacks on civilians after 13 years of war.
No group claimed responsibility for the suicide bombing, which comes just before another round of peace negotiations between the government and Taliban militants are due to start.
The suicide attacker detonated his explosives-laden vest in the main market of the volatile district of Almar, killing at least 19 people, according to Faryab police chief Subhan Quli Ebrahimi and the United Nations.
Almar district chief Saleh Mohammad Saleh said that some of the wounded were in a critical condition and had been taken to the provincial capital Maimanah.
"We had received intelligence reports that a suicide attacker has entered the market in Almar, so we set up a police check point to search for him," local police commander Saif, who goes by one name, told AFP.
"We were looking for him when he blew himself up near an armoured military vehicle," Saif said, adding that the attacker was aged between 20 and 25.
Government forces launched a counter offensive earlier this week but have struggled to regain territory, with skirmishes frequently reported between both sides.
Taliban insurgents, who launched their annual summer offensive in late April, have stepped up attacks on government and foreign targets despite official efforts to jumpstart peace talks.
Civilians often fall victim to such attacks, with almost 1,000 Afghan civilians killed during the first four months of the year, according to the United Nations Assistance Mission in Afghanistan (UNAMA).
"(Wednesday's) horrific attack against civilians in a market demonstrates an appalling disregard for human life," UNAMA chief Nicholas Haysom said in a statement.
