"I announce from here the end and the failure and the collapse of the terrorist state of falsehood and terrorism which the terrorist Daesh announced from Mosul," he said in a speech shown on state television, using an Arabic acronym for ISIS.
The fall of Mosul effectively marks the end of the Iraqi half of the ISIS caliphate, which also includes territory in Syria. The group still controls territory west and south of the city.
A 100,000-strong coalition of Iraqi government units, Kurdish Peshmerga fighters and Shi'ite militias launched the offensive to recapture the city from the militants in October, with key air and ground support from a U.S.-led coalition.
Abadi, wearing a black military uniform and flanked by commanders from the security forces, thanked troops and the coalition. But he warned that more challenges lay ahead.
About 900,000 residents have been displaced by the fighting, and thousands of civilians are believed to have been killed.
The whereabouts of ISIS leader Abu Bakr al-Baghdadi, who announced the founding of the caliphate from Mosul three years ago, is not clear.
There have been several unconfirmed claims of his death. U.S. and Iraqi military sources say he may be hiding in the border area between Iraq and Syria.