National security spokesman Mike Omeri called the pledge “an act of desperation and comes at a time when Boko Haram is suffering heavy losses”.
The Islamists’ leader Abubakar Shekau made the announcement in an audio message on Saturday night after months of indications that Boko Haram was seeking a formal tie-up.
Troops from Nigeria, Cameroon, Chad and Niger have claimed a series of successes against the militants since last month, pushing them out of captured territory in northeast Nigeria.
The operation is designed to secure and stabilise the region in time for Nigerian general elections, which were postponed by six weeks from February 14 to March 28.
Omeri said in a statement that the four-nation coalition force was “rooting out Boko Haram out of its strongholds and degrading its combat abilities”.
“Boko Haram is on the way to being eliminated,” he added.
“No foreign extremists can or will change this fact –- as long as the Nigerian military continues to receive cooperation and commitment from its citizens and allies.”
Boko Haram’s seizure of territory in three northeast states from mid-2014 — a tactic also seen by IS in Syria and Iraq — raised fears of a loss of government control in the remote region.
Security analysts have said the pledge of allegiance to IS leader Abu Bakr al-Baghdadi may only have propaganda value in the short term but in the future could lead to closer links.
But Omeri said on Tuesday: “There will be no Islamic State in Nigeria, the only state that will exist is the united Federal Republic of Nigeria.”
Troops from Chad and Niger on Monday said they had retaken the town of Damasak, in Borno state, northeast Nigeria, which Boko Haram had held since last November,
According to a Chadian security source, some 200 Boko Haram fighters were killed in the offensive that began on Sunday, although there was no independent verification of the claim.
Army spokesman Colonel Sani Usman said rebel fighters “met their Waterloo” as they tried to attack Gombi in Adamawa state on Monday evening.
“Quite a number” of insurgents were killed in a battle with the Nigerian Army, Usman said in a statement on Tuesday, without specifying numbers. One government soldier was wounded, he added.
Weapons recovered from Boko Haram included three anti-aircraft guns, two machineguns, thousands of rounds of ammunition and a rocket propelled grenade.
The military squeeze, however, has not stopped the violence, with Boko Haram reverting increasingly to guerrilla tactics in urban areas.
On Saturday, at least 58 people were killed and 139 injured in three separate bombings in the Borno state capital, Maiduguri.