A flame rises from a chimney at the Taq Taq oil field in Arbil, in Iraq’s Kurdistan region on Aug. 16, 2014. (Stringer/Reuters)

In a pact that bolsters Iraq’s unity amid its war with Islamic State extremists, the Iraqi government agreed on an oil deal Tuesday with the semiautonomous Kurdish region, ending years of political deadlock.

The agreement, to be implemented Jan. 1, resolves a bitter dispute between Baghdad and Irbil, the Kurdish regional capital, over finances. The standoff has hampered cooperation in the face of this year’s assault by the Islamic State, a radical, heavily armed and well-financed al-Qaeda offshoot.

The deal marks a significant breakthrough for Iraq’s new prime minister, Haider al-Abadi, who has pledged to repair relations between the Shiite-led government and the country’s Sunni and Kurdish minorities. Those relations crumbled during the eight-year tenure of Abadi’s predecessor, Nouri al-Maliki.

Crippling economics galvanized both sides to reach a deal, with the Kurds unable to pay salaries amid a freeze in budget payments from Baghdad and the central government desperate to plug the gap created by a dive in global oil prices.

“It’s a fair and just deal for both sides, which will really pave the way for improved relations between Baghdad and Irbil,” said Finance Minister Hoshyar Zebari. “We can now get on with fighting ISIS.”

Under the deal, the Kurds are to turn over 550,000 barrels of oil a day to central authorities — representing about a fifth of the country’s current exports. In exchange, Irbil will receive 17 percent of the national budget. An additional $1 billion will go to pay and equip Kurdistan’s security forces, known as the peshmerga, which are battling Islamic State militants along much of the region’s 650-mile southern border.

Negotiating an oil-sharing pact — and seeking to address other differences with the Kurds — was seen as an important test for Abadi, who took power in September with the aim of introducing a more inclusive political atmosphere in a country on the brink of collapse.

“This has been one of those defining moments in a premiership,” said Michael Knights, an Iraq analyst at the Washington Institute for Near East Policy. “Abadi has owned this. More is changing in the Iraqi government in a few months than changed in a positive way in eight years of Maliki.”

The oil deal was unanimously endorsed by the cabinet but still needs parliamentary approval. About 300,000 barrels of the oil to be passed from Irbil to Baghdad will come from oil fields around Kirkuk that were seized by the Kurds as Iraqi forces collapsed in June as the Islamic State advanced. The other 250,000 barrels will be pumped from oil fields in the Kurdish region.

Iraq froze its budget payments to the Kurdistan Regional Government this year after the Kurds moved to sell oil independently, circumventing the central government in Baghdad. Kurdish government workers — and peshmerga fighters — went unpaid for months.

Amid the freeze, Irbil stepped up its efforts to sell oil independently, but the process has been legally fraught. The United States was among countries that refused to recognize the Kurdish oil sales as legal.

Meanwhile, a recent drop in oil prices has hurt Baghdad. The International Monetary Fund predicts that the Iraqi economy will shrink this year for the first time since 2003.

“We were advised by every single expert that the only way for Iraq to balance our budget was to increase production,” said Zebari. “So Baghdad wanted that 550,000 barrels, and Kurdistan needed a deal for salaries and the budget. Everybody wins.”

Rafid Jaboori, a spokesman for Abadi, described the pact as a “win-win deal” and said it raises hopes for agreement in parliament on Iraq’s 2015 budget, amid ballooning expenditures. Because of infighting, the previous year’s budget never passed.

The State Department congratulated the Iraqi and Kurdish governments on a deal that it said allows “all Iraqis to benefit equitably” and strengthens the fight against the Islamic State.

As the militants seized Mosul, the largest city in northern Iraq, in a June offensive, the United States tied military assistance to the creation of a new and more inclusive Iraqi political environment. Tuesday’s rapprochement between Baghdad and the Kurds is a major step toward that end.

Abadi also has been holding regular meetings with Sunni tribal leaders who complained of distrust and marginalization under Maliki. He is trying to clamp down on graft, and on Sunday he announced the discovery of 50,000 “ghost soldiers” in the Iraqi army — a corrupt practice in which salaries are drawn for soldiers who do not exist. A day later, Abadi said that 24 senior Interior Ministry officials would be retired as part of his efforts to restructure the security forces.

“This guy is really cooking with gas,” Knights said.

Murphy reported from Washington.