The militants, packed into four trucks and flanked by gunmen on motorbikes, swept into the village of Kuda in Adamawa state late on Monday afternoon, firing as they came.
Villagers fled the attack but returned on Tuesday to bury the dead left amid the charred wreckage of their homes.
“They opened fire on residents, killing 21 people,” said community leader Maina Ularamu. “They burnt several homes.”
Ularamu lost three brothers-in-law in the attack.
“Two-thirds of the village has been burnt,” said resident Paul Waramulu, speaking to AFP by telephone from the village, giving the same toll of those killed.
Waramulu said the fighters had looted food supplies before setting fire to buildings.
Many villagers were terrified and were still hiding in surrounding bush, and those who came back did so to give funerals to those killed, he added.
The village of Kuda lies in the Madagali district of Adamawa state, some 285 kilometres (177 miles) north of the state capital Yola.
There was no immediate official response from the army or police.
The attack is the latest in a long line of massacres carried out by Boko Haram in the area, who have hideouts in the dense forests nearby.
The decade-long jihadist conflict has killed tens of thousands of people and forced millions from their homes.
The violence has spread to neighbouring Niger, Chad and Cameroon, prompting a regional military coalition against the jihadists.