The car bomb detonated in the Alpuri market in the northwest Shangla district of Swat Valley, a region that was declared clear of militants by the Pakistani military after a summer offensive.
"Such attacks cannot deter us from the offensive against the militants," said provincial Information Minister Mian Iftikhar Hussain, according to the Associated Press. "We will continue our fight till the death of the last terrorist."
Police say the target was a military convoy. No one immediately claimed responsibility.
Forty one people were killed, including six security officers. Another 45 people were wounded. The attack is the fourth in just over a week in Pakistan. Last week a suicide bomber blew himself up in Islamabad and another car bomb exploded in Peshawar that killed 53 people.
Over the weekend, Taliban militants disguised as soldiers infiltrated the Pakistan army's headquarters in Rawalpindi and took 42 hostages, resulting in a 22-hour standoff that ended with commandos storming the building.
Nine gunmen, 11 soldiers and three of the hostages were killed. The attack was planned in South Waziristan, a stronghold for Pakistan's Taliban, the army said. The Taliban, however, said the strike originated in a Punjabi faction, indicating that the Taliban's reach has extended beyond its base in the Pashtun areas of Pakistan near the Afghan border.
Army spokesman Major General Athar Abbas said the goal was to talk senior military officials hostage to demand release of captured militants.
The Pakistani army is preparing to launch a ground offensive in South Waziristan to flush out fighters linked to al-Qaida.
Pakistani Taliban spokesman Azam Tariq claimed responsibility for the raid and said it was to avenge the killing of leader Baitullah Mehsud who was killed in August by an American missile strike.
"We will take revenge for our martyrs and will carry out more attacks, whether it's the GHQ or something bigger," Tariq told Reuters by phone.
---- Compiled from wire reports and other media sources