Nobody immediately claimed responsibility for the attack in the capital of Faryab province, but it happened in an area where the Taliban and allied militant groups are active.
The Taliban have threatened a campaign of violence to disrupt the April 5 vote, which will choose a new president to lead the country as foreign troops prepare to end their combat mission by the end of the year.
However, most of the victims were vendors peddling fresh bread and other people at the busy roadside market area.
Provincial Governor Mohammadullah Patash said 17 people were killed, including three children, and 26 were wounded in the explosion, which struck some 200 meters away from the governor's compound.
Also Read
Employees of the nearby electricity department also were among the casualties, according to the deputy governor, Abdul Satar Barez.
President Hamid Karzai also strongly condemned Tuesday's attack, saying it only served the purpose of foreigners, which he said was to kill Muslims and create instability in Afghanistan.
The Taliban have staged numerous attacks in Faryab, which lies far from their traditional strongholds in southern and eastern Afghanistan. In October 2012, a suicide bomber struck a mosque packed with senior regional officials in Maymana, killing 41 people.