"Boko Haram terrorists attempted to attack a military barracks (in Borno) at about 5:00 am (local time)," spokesman Lieutenant Colonel Sagir Musa said in a statement.
He said the attack occurred in the village of Monguno, about 200 kilometres (124 miles) from Borno's restive capital of Maiduguri, considered to be Boko Haram's headquarter.
"The encounter led to the deaths of 20 Boko Haram terrorists," Musa said, adding that the attack was "repelled".
The gunmen came in large numbers with Kalashnikovs and rocket-propelled grenade launchers, he said.
"They came with three trucks and several motorcycles," he added.
Boko Haram wants to install Islamic sharia rule in Africa's top oil producing country.
The militant outfit has killed thousands through suicide attacks, bombings and shootings.
Nigeria is a secular state and has two major religions, Islam and Christianity.
Christians are found mainly in the south while Muslims are predominant in the north but they share the 150 million population of the country in roughly equal proportion.
Abuja: Nigerian military on Sunday killed 20 members of radical Islamist militant group Boko Haram as it repelled their attack on Army barracks in the northeastern state of Borno.
First Published: Sunday, March 03, 2013, 22:44