Baghdad regained control of Baiji -- located on the road to ISIS hub Mosul and near the country's largest oil refinery -- last year, but subsequently lost it again.
Iraqi forces with the support of Popular Mobilization now in control of Baiji city.
"Forces have cleansed and are in control completely of government complex, city center, Fatah mosque (main mosque) and surrounding neighborhoods," said Brig. Gen. Tahseen Ibrahim, a spokesman for the Iraqi defense ministry.
"We can announce that Baiji city is completely liberated and the Iraqi flag was raised over the governor building," said Muhammed al-Eqabi, a spokesman for the Hash al-Shaabi Shia militia.
ISIS forces, who had seized the city, fled back toward Mosul and were under air attack while retreating, according to Ibrahim.