The attack took place on the campus of Bacha Khan University in Charsadda town in the north-western province of Khyber-Pakhtunkhwa, an area that has long been a stronghold of Taliban militants.
The Taliban claimed responsibility for the attack, saying it was revenge for the death of their fighters at the hands of Pakistani security forces, according to Umer Mansour, a Taliban spokesman.
At least 1,000 students were on campus when the shooting started, a police official told dpa, asking not to be named.
Soldiers and police were both called in to help, a military statement said.
“Male and female students, security guards and teachers are among the dead,” said hospital medic Zubair Ali.
Pakistani Premier Nawaz Sharif (pic) said the attackers have no faith or religion and condemned their actions.
“We are determined and resolved in our commitment to wipe out the menace of terrorism from our homeland,” he said in a statement.