This article is more than
7 year oldPrime Minister Haider al-Abadi told a conference in Baghdad that Iraqi troops were now in complete control of the Iraqi-Syrian border.
The border zone contained the last few areas IS held, following its loss of the town of Rawa in November.
The Iraqi announcement comes two days after the Russian military declared it had accomplished its mission of defeating IS in neighbouring Syria.
The jihadist group had seized large swathes of Syria and Iraq in 2014, when it proclaimed a "caliphate" and imposed its rule over some 10 million people.
But it suffered a series of defeats over the past two years, losing Iraq's second city of Mosul this July and its de facto capital of Raqqa in northern Syria last month.
Some IS fighters are reported to have dispersed into the Syrian countryside, while others are believed to have escaped across the Turkish border.
By Sebastian Usher, BBC Arab affairs editor
This is undeniably a proud moment for Mr Abadi - a victory that once looked like it might only ever be rhetorical rather than real.
But if the direct military war with IS in Iraq is genuinely over, and the country's elite forces can now step back after a conflict that's taken a huge toll on them, it doesn't mean the battle against the group's ideology or its ability to stage an insurgency is finished - whether in Iraq, Syria or the wider world.
Attacks may be at a lower level than they once were, but Iraqi towns and cities still fall prey to suicide bombers, while the conditions that fuelled the growth of jihadism remain - even in the territory that's been recaptured.
Mr Abadi said on Saturday: "Our forces are in complete control of the Iraqi-Syrian border and I therefore announce the end of the war against Daesh [IS].
"Our enemy wanted to kill our civilisation, but we have won through our unity and our determination. We have triumphed in little time."
The Iraqi armed forces issued a statement saying Iraq had been "totally liberated" from IS.
Last month, the Syrian military said it had "fully liberated" the eastern border town of Albu Kamal, IS's last urban stronghold in that country.
On Thursday, the head of the Russian general staff's operations, Col-Gen Sergei Rudskoi, said: "The mission to defeat bandit units of the Islamic State terrorist organisation on the territory of Syria, carried out by the armed forces of the Russian Federation, has been accomplished."
He said Russia's military presence in Syria would now concentrate on preserving ceasefires and restoring peace.
The collapse of IS has raised fears that its foreign fighters will escape over Syria's borders to carry out more attacks abroad.