The attackers reportedly targeted only male students and “spared” girls at the Federal Government College in the town of Buni Yadi in Yobe state, which teaches pupils aged 11 to 18.
Gunmen hurled explosives into residential buildings, sprayed gunfire into rooms and hacked or burned some students to death.
All of the school’s 24 buildings were then burned to the ground, Police Commissioner Sanusi Rufai said.
“Some of the students’ bodies were burned to ashes,” said Rufai.
Bala Ajiya, an official at the Sana Abachi Specialist Hospital in Yobe’s capital Damaturu, said some bodies were discovered in nearby bushland where students who had escaped with bullet wounds had died from their injuries.
The raid at 2am (1am GMT) on Tuesday bore the hallmarks of a similar attack last September in which 40 died.
People whose relatives were studying at the college had surrounded the morgue and were desperately seeking information about those killed, forcing the military to take control of the building to restore calm.
Yobe has been one of the hardest hit areas in Boko Haram’s four-and-a-half year uprising, which has killed thousands of people.
It is one of three northeastern states to be placed under emergency rule in May last year when the military launched a massive operation to crush the uprising.
The name Boko Haram means “Western education is forbidden” and the rebels have carried out waves of school attacks, especially in Yobe, where scores of students have been slaughtered in the past year.
The state is one of three in the country’s northeast to be placed under emergency rule in May last year when the military launced a massive operation to crush the uprising.
More than 1,000 people have been killed in the region since the emergency measures were imposed, despite the enhanced military presence.
Boko Haram, declared a “terrorist organisation” by Nigeria and the US, has said it is fighting to create an Islamic state in Nigeria’s mainly Muslim north.