Army spokesman Sagir Musa said five rebel fighters “met their Waterloo” as they attempted to overrun a military base in Buni Yadi, in Yobe state, at about 6:00 pm (1700 GMT) on Saturday.
“An officer and three soldiers have lost their lives during the encounter. While five soldiers were wounded are stable and reciving treatment in the Brigade Field Ambulance,” he added
The military base in Buni Yadi has been targeted before in the conflict.
In January, two military sources told AFP the Islamic State-allied faction of Boko Haram killed four soldiers and were repelled after air support was called in.
In recent months there have been a wave of attacks in the buni Yadi area, which is near the border with Borno state — the epicentre of fighting since 2009.
Most of the attacks on military positions and troops have been blamed on or claimed by the self-styled Islamic State West Africa Province (ISWAP) faction.
Nigeria’s President Muhammadu Buhari, who was elected in 2015 on a promise to defeat the Islamist militants, maintains the group is “technically defeated”.
Buni Yadi was the scene of one of Boko Haram’s most notorious attacks, when fighters loyal to long-time leader Abubakar Shekau stormed a boys’ boarding school in February 2014.
More than 40 students were killed as they slept.