Mass funerals are under way for 142 people, most of them children, killed in a massacre by the Taliban at a military-run school in Pakistan.

Prayer vigils were held across the nation, and in other schools students spoke of their shock at the carnage in the city of Peshawar where seven Taliban gunmen, explosives strapped to their bodies, scaled a back wall to get into the Army Public School and College on Tuesday morning.

Students were gunned down and some of the female teachers were burned alive. The attack was the deadliest slaughter of innocents in the country and horrified a nation already weary of unending terrorist assaults.

Army commandos fought the Taliban in a day-long battle until the school was cleared and all the attackers dead.

The government has declared a three-day mourning period, starting today. Overnight, the body of the school head, Tahira Qazi, was found among the debris from the rampage. Her death raised the earlier reported death toll of 141.

Some of the funerals were held overnight, but most of the 132 children and 10 staff members killed in the attack will be buried today. Another 121 students and three staff members were wounded.

"They finished in minutes what I had lived my whole life for, my son," said laborer Akhtar Hussain, tears streaming down his face as he buried his 14-year-old, Fahad. He said he had worked for years in Dubai to earn a livelihood for his children.

"That innocent one is now gone in the grave, and I can't wait to join him, I can't live any more," he wailed, banging his fists against his head.

The Taliban said the attack was revenge for a military offensive against their safe havens in the north west, along the border with Afghanistan, which began in June. Analysts said the school siege showed that even diminished, the militant group could still inflict horrific carnage.

The attack drew swift condemnation from around the world. President Barack Obama said the "terrorists have once again showed their depravity".

Pakistan's teenage Nobel Peace laureate Malala Yousafzai - herself a survivor of a Taliban shooting - said she was "heartbroken" by the bloodshed.

Even Taliban militants in neighbouring Afghanistan decried the killing spree, calling it "un-Islamic".

Pakistani prime minister Nawaz Sharif pledged to step up the campaign that - along with US drone strikes - has targeted the militants.

"We will take account of each and every drop of our children's blood," said Mr Sharif, who rushed to Peshawar shortly after the attack to offer support for the victims.

In neighbouring India, which has long accused Pakistan of supporting anti-India guerrillas, schools observed two minutes of silence for the Peshawar victims at the urging of prime minister Narendra Modi, who called the attack "a senseless act of unspeakable brutality".