"We announced the reclaiming of Goniri today," defence spokesman Chris Olukolade said on his Twitter account @GENOlukolade. "That was the last stronghold of terrorists in Yobe... #YobeIsFree."
Three states -- Adamawa, Borno and Yobe -- have been the epicentre of the six-year-old Boko Haram violence that has killed more than 13,000 and displaced 1.5 million people.
The states were placed under a state of emergency in May 2013, which saw troops and civilian vigilantes force the Islamists out of urban centres into more remote, rural areas.
The violence continued and even intensified, however, with the Nigerian military unable to stop a takeover of dozens of towns and villages in all three states.
More From This Section
Nigeria's presidential election was delayed by six weeks because of the Boko Haram violence and a four-country military operation to secure and stabilise the northeast for voting on March 28.
Last week, the military said Adamawa state had been cleared of Boko Haram fighters.
Olukolade wrote in a separate tweet: "Adamawa is free, Yobe is free, Borno is soon to be freed by our able military."
Last week, the government said 36 towns in the three states had been recaptured as part of the operation.