The bomber struck in the market located near Sohrab Khan Chowk in Mingora, the main city in Swat district, authorities said.
The identity of the two dead persons could not immediately be ascertained.
The condition of three of the 12 injured was described by officials as critical.
Deputy Inspector General of Police (Malakand division) Qazi Jameel said the attack was carried out by a suicide bomber.
He told the media that security forces had gunned down another man who was carrying some detonators.
Shortly before the blast, security forces arrested a would-be suicide attacker and another man at Green Chowk, the main square in Mingora.
The arrests were made after security forces received a tip-off regarding the presence of two suicide bombers in the city.
Sohrab Khan Chowk is located about 100 metres from Green Chowk.
The two squares are the busiest areas in Mingora.
Huge plumes of smoke were seen billowing from the site of the blast, which caused widespread panic in the city.
Footage on television showed people carrying the injured away from the site as Army soldiers and policemen cordoned off the area and launched a search operation.
The powerful blast also damaged several shops.
All markets in Mingora closed down soon after the explosion.
DIG Qazi Jameel said the situation in Swat was better than before but militants were still trying to carry out attacks to create fear among the people and cause casualties.
He said the market was chosen as a target by the bomber as it is a public area and an explosion there could cause more casualties.
Most parts of Swat were controlled by Taliban fighters led by radical cleric Maulana Fazlullah till the Army launched a major offensive last year to flush out the militants.
The Army claims Swat has been cleared of the militants.
However, militants have carried out several attacks and gunned down at least five persons, including a mayor, who opposed the Taliban, in recent weeks.
Islamabad: A suicide bomber blew himself up in a crowded market in northwest Pakistan's restive Swat valley on Saturday, killing at least two persons and injuring 12 others.
First Published: Saturday, May 01, 2010, 13:41