"Our forces are in complete control of the Iraqi-Syrian border and I therefore announce the end of the war against Daesh (IS)," Abadi told a conference in Baghdad.
"Our enemy wanted to kill our civilisation, but we have won through our unity and our determination. We have triumphed in little time," he said, hailing Iraq's "heroic armed forces".
As the authorities announced a public holiday on Sunday "to celebrate the victory", Abadi said in a speech at the defence ministry that Iraq's next battle would be to defeat the scourge of corruption.
IS seized vast areas north and west of Baghdad in a lightning offensive in 2014.
With Iraq's army and police retreating in disarray at the time, Ayatollah Ali Sistani, spiritual leader of the country's majority Shiites, called for a general mobilisation, leading to the formation of Hashed al-Shaabi paramilitary units.
Iraq's fightback was also launched with the backing of an air campaign waged by a US-led coalition, recapturing town after town from the clutches of the jihadists in fierce urban warfare.
The US State Department hailed the end of the jihadists' "vile occupation" but cautioned that the fight was not over.
"The United States joins the Government of Iraq in stressing that Iraq's liberation does not mean the fight against terrorism, and even against ISIS (IS), in Iraq is over," State Department spokeswoman Heather Nauert said.
The coalition, meanwhile, tweeted, using an Arabic acronym for IS: "Congratulations to the government of Iraq and the Iraqi security forces on the liberation of all Daesh-held populated areas in Iraq."
Hisham al-Hashemi, an expert on jihadist groups, warned that IS still posed a threat by retaining arms caches in uninhabited desert zones.
Iraq's close ally Iran already declared victory over IS last month, as the jihadists clung to just a few remaining scraps of territory.
But Abadi said at the time he would not follow suit until the desert on the border with Syria had been cleared.
The jihadists' defeat is a massive turnaround for an organisation that in 2014 ruled over seven million people in a territory as big as Italy encompassing large parts of Syria and nearly a third of Iraq.
On the Syrian side of the border, IS is under massive pressure too.
On Thursday, Russia's defence ministry said its mission in support of the Syrian regime to oust IS had been "accomplished" and the country was "completely liberated".
In the border region, pro-government forces and US-backed Kurdish-led forces are conducting operations to clear IS fighters from the countryside north of the Euphrates valley after ousting them from all Syrian towns.
IS retains capacity
The head of Iraq's Joint Operations Command set up to fight IS, General Abdel Amir Yarallah, gave an update on Saturday to announce that the desert valley of Al-Jazira was under the control of Iraqi troops and the Hashed all the way from Nineveh province in the north to Anbar in the west.
Federal forces "now control the border with Syria from Al-Walid border crossing to that of Rabia", covering a distance of 435 kilometres (270 miles), he said.
Despite the victory announcements, experts have warned that IS retains the capacity as an insurgent group to carry out high-casualty bomb attacks using sleeper cells.
Abadi's victory announcement came the same day as Iraqi forces said they killed 10 IS members in a tunnel near the northern city of Kirkuk and recovered armaments.
IS also retains natural hideouts in the deep gorges of Wadi Hauran, Iraq's longest valley stretching from the Saudi border up to the Euphrates River and the frontiers with Syria and Jordan.
The fightback in Iraq kicked off with the "liberation" of Tikrit, north of Baghdad, that had been under IS control for nearly 10 months.
The operations have involved both Tehran, through Iranian-trained Shiite militias in the Hashed al-Shaabi coalition, and Washington as head of the anti-jihadist coalition.
The western cities of Ramadi and Fallujah followed in 2016 before the turning point of the recapture of Iraq's second city of Mosul in July this year after a nine-month offensive led by a 30,000-strong federal force.
Abadi said the battle for Mosul that left the city in ruins and thousands of its residents displaced marked the end of the jihadists' "caliphate".