The town was said to serve as the headquarters of the insurgents after the Boko Haram declared the town their “caliphate” last year.
“Troops this morning captured Gwoza destroying the Headquarters of the Terrorists self-styled Caliphate,” Defence Headquarters in Abuja said on Twitter.
“Several terrorists died while many are captured. Mopping up of entire Gwoza and her suburbs is ongoing,” it added in a separate message.
According to a report by AFP earlier this month, residents who fled the town in Borno State disclosed 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.
Boko Haram leader Abubakar Shekau had declared on August 24 last year that Gwoza was “part of the Islamic caliphate”, adding to speculation the militants were imitating the Islamic State group.
In a televised address broadcast on Friday, President Goodluck Jonathan hailed troops for having “successfully stemmed the seizure of Nigerian territories”.
The President had predicted that troops would retake Gwoza Friday, a day to Nigeria’s presidential election.