“Tal Afar has been liberated,” Abadi said in a statement on Wednesday.
“We say to the Islamic State fighters: wherever you are, we are coming for you and you have no choice but to surrender or die.”
Al Jazeera’s Osama Bin Javaid, reporting from the northern Iraqi city of Erbil, said the loss of Tal Afar and the northern province is a big blow to the armed group.
“The loss of Nineveh province is crucial because this is where ISIL declared its caliphate,” Bin Javaid said.
“This province was also the engine of the ISIL economy. It is where they used to smuggle oil to other areas. It is also where they used to generate big revenues in terms of taxes,” Bin Javaid said.
The offensive on Tal Afar began on August 20.
The city is located some 70km west of Mosul and about 150km east of the Syrian border, sitting along a major road that was a key ISIL supply route.
The town had a population of about 200,000 before it fell to ISIL in 2014.
Last week, the Iraqi army said it believes some 10,000 civilians remain inside the city, adding that it had secured safe corridors for them.
Source: Al Jazeera and news agencies