The unit was on a routine patrol in Laayi village near the northeastern town of Damasak on Monday when they drove over a mine, two militia leaders told AFP.
The soldiers set off an improvised explosive device suspected to have been planted by the Islamic State West Africa (ISWAP) group, militia leader Babakura Kolo said.
The explosion "killed all five troops on board", he said.
A second militia leader, Ibrahim Liman, gave the same account and death toll as Kolo.
The jihadists had attacked the village the previous night, kidnapping four residents including the local chief and planting the explosives while retreating, Kolo said.
The army spokesman had not responded to AFP's request for comment on the incident.
The militiamen, who fight alongside the military, were not present during the incident but said they were briefed on the matter.
ISWAP, which split from jihadist group Boko Haram in 2016, has become a dominant threat in Nigeria, attacking soldiers on patrol while killing and kidnapping passengers at checkpoints.
The two rival jihadist factions have clashed in recent months while the military has intensified its offensive against the groups.
The military is set up in large bases known as "super camps" across the region, leaving some villages and rural areas unprotected and more vulnerable to attacks.
Last month three soldiers were killed and four others injured along with seven civilians in a mine explosion targeting a military truck outside the town of Banki near the border with Cameroon.
The 14-year-old insurgency has killed at least 40,000 people and displaced more than two million, according to the UN.
The violence has spread to parts of neighboring Niger, Chad and Cameroon, prompting a regional military coalition to fight the militants.