Most of the victims were travellers who were burnt to death while sleeping in their vehicles during an overnight stop, officials added
The attack took place in Auno town on a major highway in Borno State.
Militant Islamist group Boko Haram and its offshoots have waged a brutal insurgency in Nigeria since 2009.
About 35,000 people have been killed, more than two million have been left homeless and hundreds have been abducted in the conflict.
Nigeria's government has repeatedly said that the militants have been defeated, but attacks continue.