Troops heading to the town of Dikwa came under attack at about 9:00 am (0800 GMT) at Ajirin village, in the Mafa area, some 52 kilometres (32 miles) east of the Borno state capital, Maiduguri.
"There was a heavy gunfight. At least eight troops have been confirmed killed and two others injured. Boko Haram also suffered losses," a military source in Maiduguri told AFP.
"It was a surprise attack and this is what led to the casualty toll," the source added on condition of anonymity, as he is not authorised to talk to the media.
A civilian vigilante involved in helping the military with security in the restive region confirmed the account but said as many as 10 soldiers may have been killed.
No one from army headquarters in Nigeria's capital Abuja was immediately available when contacted by AFP.
Nigeria's military and government have claimed repeatedly in recent months that Boko Haram, which is allied to the Islamic State group, is in disarray and nearly defeated.
The army has mounted a sustained counter-attack against the group in its Borno state stronghold of the Sambisa forest. In December, commanders said the rebels had been flushed out.