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.
when he saw the charred bodies during a visit to Auno following Sunday night’s attack, Nigeria’s privately owned This Day news site reports.
The militants came in trucks mounted with heavy weapons, before killing, burning, and looting, state government spokesman Ahmad Abdurrahman Bundi was quoted by AFP news agency as saying.
The assailants “killed not less than 30 people who are mostly motorists and destroyed 18 vehicles,” the governor’s office said in a statement.
It also confirmed the abduction of women and children, but did not give a number.
Residents said most of the victims were travelling to the state capital, Maiduguri, but were forced to sleep in Auno, about 25km (16 miles) away, because the military had shut the road leading into the city.
The military has not yet commented.
Maiduguri was once the headquarters of Boko Haram, but government forces eventually drove the group out of the city.
It is unclear whether the assault was carried out by Boko Haram or a breakaway faction linked to the Islamic State (IS) group.
Calls for military shake-up
The attack in Auno is a reminder of the threat posed by militants, and the vulnerability of communities.
When President Muhammadu Buhari came to power in 2015, he pledged to defeat the insurgents.
Although his troops have made significant progress in weakening the militants, the recent spate of attacks on both military and civilian targets threatens the initial gains.
Many Nigerians have therefore been calling for an overhaul of the security forces and the replacement of military chiefs.
They hope that new generals at the helm of the security forces will reinvigorate the fight against the militants and make sure that the decade-long insurgency does not get any worse.