Its recapture further isolates militants farther south in the city of Tikrit, the hometown of executed dictator Saddam Hussein, although IS still controls large parts of Iraq as well as swathes of Syria.
"Iraqi forces were able to regain complete control of the town of Baiji," Ahmed al-Krayim, the head of the Salaheddin provincial council, told AFP.
Soldiers, police, Shiite militiamen and tribesmen were all involved in the operation to retake Baiji, and are now pushing farther north, Krayim said.
"Iraqi forces are on their way to the Baiji refinery," north of the town, where security forces have held out against repeated jihadist attacks, he said.
Breaking through to the massive refinery would be another significant win for the government in Baghdad.
- 'War crimes' -
On Friday, the UN Commission of Inquiry on Syria released its first report focused squarely on IS crimes, presenting a horrifying picture of what life is like in areas controlled by the jihadists, including massacres, beheadings, torture, sexual enslavement and forced pregnancy.
"The commanders of ISIS (IS) have acted wilfully, perpetrating these war crimes and crimes against humanity with clear intent of attacking persons with awareness of their civilian or 'hors de combat' (non-combat) status," the report said.
Britain's Prime Minister David Cameron meanwhile outlined plans to seize the passports of British jihadists to stop them from returning after fighting overseas.
Hundreds of citizens from various western countries have joined IS and other militant groups, raising fears that they may come home to carry out attacks.
The operation to retake Baiji began more than four weeks ago when security forces and pro-government fighters started advancing towards the town from the south, slowed by bombs militants had planted on the way, and finally entered on October 31.
The nearby Baiji refinery once produced some 300,000 barrels of refined petroleum products per day, meeting 50 percent of the country's needs, but it would take time before it could be brought back online.
The town's recapture was marred by a suicide bombing Friday that targeted a military command headquarters set up at Tikrit University, south of Baiji, killing at least four people, army officers said.
- Baghdad blasts kill 17 -
Baghdad was also hit by violence on Friday, when two car bombs killed at least 17 people and wounded at least 57, officials said.
Iraqi troops initially struggled to regain ground from IS after the start of the jihadist offensive.
But helped by US-led air strikes, support from Shiite militias and Sunni tribesmen, assistance from international advisers, and a signficant reshuffling of top officers, Baghdad's forces have begun to make progress.
Washington has repeatedly said that it will not deploy "combat troops" to Iraq, though top US military officer General Martin Dempsey said Thursday that sending small teams of US troops into combat with local forces remained an option.
The US has already announced plans to send up to 3,100 military personnel to Iraq to advise and train its forces and protect American facilities.
IS released an audio message Thursday it said was from its chief Abu Bakr al-Baghdadi -- rumoured to have been wounded or killed in air strikes -- in which he vowed the group will continue to expand and draw its enemies into combat on the ground.
Dempsey also predicted that if the government in Baghdad fails to follow through on promises to bring the country's Sunni Arab and Kurdish minorities back into the fold, "then the Iraqi security forces will not hold together."
Iraqi Prime Minister Haidar al-Abadi's government has made progress on one of those fronts, reaching an initial agreement with the country's autonomous Kurdish region to ease long-running disputes over finances and oil.