The shell destroyed a house in Allahabad, a village in the Swat valley, as security forces continued an offensive against the followers of a fugitive pro-Taliban cleric late Wednesday, a police official said.
Eleven members of the family died, while nine more were wounded, said the official, Mohibullah Khan.
Military officials were not immediately available for comment.
Some 15,000 Pakistani troops have been engaged in a major assault on Islamic militants in the scenic northern valley, whose fall has raised concern about Pakistan's ability to withstand rising extremism.
Security forces have been fighting in the region, a former tourist destination just 160 kilometers (100 miles) from the capital, since July, when a bloody army raid on a radical mosque in Islamabad sparked a wave of militant violence.
Foreign fighters have allegedly joined the armed followers of Maulana Fazlullah, a pro-Taliban cleric in the valley, amplifying Western fears that swaths of Pakistan near the Afghan border offer an increasingly safe haven for al-Qaida.
Washington has expressed concern about rising violence in Pakistan, where well over 1,000 security forces, civilians and militants have died in the past five months.
Associated Press Television News Thursday interviewed several of the men and women injured in the blast. Speaking from a government hospital in Saidu Sharif, a town in the valley, they blamed the army for firing on unarmed villagers during the operation.
"I was walking down the road when soldiers opened fire and a bullet pierced my hand," said Razia Khanam, 17. "I was carrying a bag containing clothes, and when the soldiers started firing I hid in a drain by the road."
Gul Bacha, 42, said that when his family tried to return to their home to take care of the farm animals, the soldiers blocked them. "Suddenly they opened fire on the people and killed a boy who was walking by," he said.
The army has said that troops backed by helicopter gunships and artillery were attacking militants to push them back into the mountains overlooking the Karakoram Highway, Pakistan's vital overland route to China.
A military statement on Thursday said that 19 suspected militants, including a brother of Maulana Fazlullah, were captured in Swat.
Fazlullah, who is wanted by authorities, is on the run and has used a pirate FM radio to call for support and a holy war against the government.
The five soldiers died when a bomb hit their pickup truck about 30 kilometers (19 miles) from Miran Shah, the main town in the troubled North Waziristan border region, officials said.
Four more soldiers were wounded in the blast, Maj. Gen. Waheed Arshad said on Dawn News television.
A local intelligence official said the wounded soldiers were taken to a hospital in Mir Ali, a militant stronghold and launchpad for attacks on U.S. troops across the border in Afghanistan.
Arshad told Dawn News television that troops had found the bodies of six militants in the mountains on Wednesday. He said they included two Uzbeks.
Arshad said the army operation was going according to plan and that the local population had turned on the militants, killing some of their leaders.
"It augurs well for lasting peace in the area," he said.