A boy of about 17-year-old wearing a suicide vest entered the mosque along with other worshippers.
Nigeria's President Muhammadu Buhari, who announced almost two years ago that Boko Haram was "technically defeated", described the blast as "very cruel and dastardly".
NAN reports that the attack happened in Dazala area of Mubi town in Adamawa on Tuesday around 5 a.m. when Muslims were observing the early morning prayer.
It was the biggest attack in Adamawa since December 2016, when two female suicide bombers killed 45 people at a crowded market in the town of Madagali.
Abubakar Sule, who lives near the mosque, said he was present during the rescue operation and that 40 people died on the spot while several others were taken to hospital with severe and life-threatening injuries.
"It was a devastating attack on the mosque as people gathered for prayer", said Al Jazeera's Ahmed Idris, reporting from Nigeria's capital, Abuja.
"It fits with the increasing lethality and potency of suicide attacks of the organization's current "hot streak", which started approximately four weeks ago", counterterrorism specialist Yan St-Pierre said.
In a statement, the president's office said the government would do "everything required to secure the state from the deadly menace of Boko Haram".
Mubi is in Adamawa state where Boko Haram held territory in 2014.
"They are feeling the heat".
Boko Haram has waged an insurgency in northeastern Nigeria since 2009 in its attempt to create an Islamic state in the region.
Boko Haram fighters killed six farmers outside Maiduguri, the civilian militia and the brother of one of the victims said on Monday. The extremists' offensive has also spilled over into neighboring Chad, Niger and Cameroon.