Nigeria's military on Friday announced that troops had retaken the town of Gwoza from Boko Haram, from which the group declared their caliphate last year.
Defence spokesman Chris Olukolade told a news conference in the capital, Abuja, that the recapture came after "concerted and well-coordinated land and air operations".
"A lot of arms and ammunition have been recovered and the administrative headquarters (of Boko Haram) completely destroyed," he said.
"A massive cordon and search has commenced to locate any of the fleeing terrorists or hostages in their custody."
Earlier this month, residents who fled the town in Borno state told AFP that militants had been massing in Gwoza and killing local people who were unable to flee.
That led to speculation that the group, which has been pushed out of a number of towns in three northeast states in recent weeks, was preparing for a final assault.
Olukolade said dead bodies had been discovered in a well, while one man who was forcibly conscripted into the militants' ranks said the group's leader had ordered women in the town to be killed.
Usman Ali, a 35-year-old farmer, said Abubakar Shekau addressed his fighters on March 15 and told them to kill the women they have taken as wives.
"He said they should go back to Gwoza and kill all of their women they left behind. He said if they didn't kill them they would not join them in paradise," he told AFP after managing to escape.
"They took us along to Gwoza where we witnessed the carnage."
Earlier this month residents who fled Bama, also in Borno state, had also reported that dozens of women forced into marriage with Boko Haram fighters were killed.
On August 24 last year, Shekau declared that Gwoza was "part of the Islamic caliphate", adding to speculation the militants were imitating the Islamic State group.
Shekau had the previous month praised IS leader Abu Bakr al-Baghdadi but stopped short of pledging allegiance. He has since formally allied himself to the group in Syria and Iraq.
Nigeria's national security spokesman Mike Omeri said last week that troops had begun the "final onslaught" against Boko Haram, saying Gwoza was one of three areas yet to be retaken.
Olukolade said on Friday: "As at yesterday, the military has been able to take over virtually all the enclaves and hideouts where the terrorists were marauding.
"It is observed that some of the terrorists are currently fleeing towards border areas."
He said fleeing Boko Haram fighters were likely to "run into subsequent encounter(s) with contingents" of the Multinational Joint Task Force who have been mandated to contain them, he added.
A four-nation coalition of Nigeria, Niger, Chad and Cameroon has claimed a number of successes since the turn of the year to end the insurgency which has claimed more than 13,000 lives since 2009.
The ongoing operation was cited as a reason to delay Nigeria's general election on February 14 to this Saturday, as soldiers would not be able to provide security nationwide.
In a televised address broadcast on Friday before weekend elections, President Goodluck Jonathan hailed troops for having "successfully stemmed the seizure of Nigerian territories".
But Chad's President Idriss Deby accused Nigeria of failing to cooperate with the regional coalition battling the militants, saying there had been zero contact between their armies.
"The whole world is asking why the Nigerian army, which is a big army... is not in a position to stand up to untrained kids armed with Kalashnikovs," Deby told French magazine Le Point, in an interview published this week.