Troops, police and paramilitary forces "liberated the whole of the center of Hawija and are continuing their advance," operation commander Lieutenant General Abdel Amir Yarallah said in a statement.
The offensive was led by Iraqi government troops and Iranian-trained and armed Shi'ite paramilitary groups known as Popular Mobilisation.
The United Nations estimated that 12,500 people had fled the town since the launch of the offensive last month. It said on Tuesday there could have been as many as 78,000 people left in the town.
Hawija, 230 kilometres (140 miles) north of Baghdad, had remained an insurgent bastion since soon after the US-led invasion of 2003. It was labeled "Kandahar in Iraq" for its similarities to the Taliban militia's citadel in Afghanistan.
Journalists on the ground shared images of dozens of IS fighters surrendering.
Iraqi Prime Minister Haider al-Abadi confirmed the recapture after talks with French President Emmanuel Macron in Paris. "Only the outskirts remain to be recaptured," he said.
"This victory is not just a victory for the Iraqis, but for the whole world."
He his forces would now focus on the border zone with Syria in their fight against IS.
The Sunni Arab town of Hawaji was complicated to take given its hostility to both to the Shiite-led government in Baghdad and to the neighboring Kurds. It comes under the Kirkuk governorate, which is disputed between Baghdad and the northern Iraqi Kurdish autonomous region.