A convoy of fighters in pickup trucks descended on Dapchi village in the Bursari area of Yobe state around 6 pm (1700 GMT) targeting the school, resident Sheriff Aisami told AFP.
"When they stormed the village they began shooting and setting off explosives," Aisami said.
"This drew the attention of the girls in the Girls Science Secondary School, so the girls and the teachers were able to escape before the attackers got into the school."
Unable to kidnap the girls, the Boko Haram fighters looted the school before fleeing.
"There was an attack on the girls secondary school in Dapchi by Boko Haram," said a member of a local civilian militia battling the terrorist group.
"Obviously the attack was meant to abduct school girls but luckily they found none of the girls as they were taken away by teachers before they arrived," said the militia member, who declined to provide his name for safety reasons.
"Military jets were deployed and are in pursuit", he added.
It's unclear whether anyone was killed in the violence.
The attack recalls Boko Haram's audacious kidnapping of more than 200 schoolgirls from the town of Chibok in April, 2014.
The kidnapping drew the world's attention to the jihadist insurgency in northeast Nigeria.
Nigerian President Muhammadu Buhari, a former general, came to power in 2015 on a platform promising to stamp out the Islamist movement.
But despite retaking swathes of territory from Boko Haram, the terror group continues to stage attacks targeting both civilians and military targets, and frequently uses young girls as suicide bombers.
Since 2009, the Boko Haram insurgency has left at least 20,000 dead and made over 2.6 million more homeless.