Also, 10 soldiers were wounded and four are missing in action.
The troops, during the attack, also killed many of the terrorists.
In a statement on Tuesday, the Defence Headquarters confirmed the incident.
The Director, Defence Media Operations, Maj. Gen. Edward Buba, said the attack would not discourage the troops in the counter-terrorism operations in the state and beyond.
He said, “The coordinated attack saw five killed in action soldiers, 10 wounded, and four missing in action, while troops eliminated several terrorists as well as recovered weapons.
“Some equipment, including one gun truck, three TCVs, and an excavator, were burnt by the enemy forces.
“A reinforcement team with air components was dispatched to exploit the general area and the terrorists’ withdrawal route.
“However, it is pertinent to note that such an attack shall not deter the troops and armed forces of Nigeria from seeing the end of terrorism, insurgency, and other insecurity challenges facing the country.”