The three-year stand-by arrangement was reached by the Iraqi government and IMF in Jordan after a week of talks, the monetary institution said.
"Under the arrangement, and subject to the approval of the IMF executive board, Iraq could have access to IMF credit amounting to... about $5.4 billion," the statement said.
In a statement issued in Amman, the IMF's Iraq head of mission, Christian Josz, said the deal was justified by the cost of the war on the Islamic State group and the sharp fall in oil prices.
"Iraq has been hit hard by the conflict with ISIS (another acronym for IS) and the precipitous fall in oil prices," he said.
Signup to our newsletter and follow us on Facebook and Twitter!
"To address the urgent balance of payments need, the Iraqi authorities and IMF staff have agreed on a three-year programme of economic and financial policies that will bring spending in line with the lower level of oil prices and ensure debt sustainability," he said.
Josz said the loan could start being disbursed in June or July "once agreed prior actions have been implemented".
That could in turn improve Iraq's credit rating and encourage donors to avail further financing.
Brett McGurk, US President Barack Obama's special envoy to the international coalition fighting IS, welcomed what he described on social media as a "critical agreement".
The IMF statement explained that a staff-level agreement conveys "preliminary findings after a visit to a country" and that a final deal is subject to the IMF board's approval.