(Bloomberg) — Oil surged after OPEC approved the first supply cuts in eight years in an effort to ease a record glut and stabilize global markets.

Futures rose 9.3% in New York, the biggest gain since February. OPEC agreed to reduce collective production to 32.5 million barrels a day, Iranian Oil Minister Bijan Namdar Zanganeh said in Vienna Wednesday. The accord comes into effect at the start of 2017 and will last six months. The pact also calls for an additional 600,000 barrels a day of cuts from non-OPEC suppliers.

Oil has whipsawed since a production-cut was first proposed in Algiers in September and investors speculated about whether an accord could be struck. Right to the end, major obstacles threatened to sink the deal.

"OPEC has delivered on its Algiers goal to achieve a collective cut, but as always the devil is in the details," Harry Tchilinguirian, head of commodity markets strategy at BNP Paribas SA in London, said by telephone. "What are the baselines of the cuts and the perennial issue of execution risk looms large. Furthermore, despite hopes for non-OPEC participation, the historical track record has been dismal."

West Texas Intermediate for January delivery rose $4.21 to $49.44 a barrel on the New York Mercantile Exchange. It’s the highest close since Oct. 27. Total volume traded was more than double the 100-day average. Prices rose 5.5% in November.

Brent for January settlement, which expired Wednesday, increased $4.09, or 8.8%, to $50.47 a barrel on the London-based ICE Futures Europe exchange. The global benchmark closed at a $1.03 premium to WTI for the same month. February Brent rose $4.52 to $51.84.

Tense Negotiations

Energy shares advanced after the OPEC pact and were the best performers on the Standard & Poor’s 500 Index. The S&P Oil & Gas Exploration and Production Select Industry index surged 11%, the most since 2008.

"The economics of this deal made so much sense for everybody," Jeff Currie, head of commodities research at Goldman Sachs Group Inc., said on Bloomberg TV. "All the parties involved should view this as successful."

After weeks of often tense negotiations, the Organization of Petroleum Exporting Countries’ three biggest producers — Saudi Arabia, Iraq and Iran — resolved differences over sharing the burden of cuts. Saudi Arabia accepted that Iran can pump about 3.8 million barrels a day after previously insisting that its regional rival limit output to 3.707 million barrels a day.

"This is a victory for Iran," Stewart Glickman, head of energy research at S&P Capital IQ in New York, said by telephone. "This takes $30 oil off the table, but it’s not a precursor to a return to the heyday of $100 oil."

Production Cuts

Saudi Arabia will cut output by 486,000 barrels a day from October to 10.058 million, according to an OPEC press release. Iraq, the group’s second-largest producer, agreed to cut production by 210,000 barrels a day. The country previously pushed for special consideration, citing the urgency of its offensive against the Islamic State. Indonesia, which is a net importer, asked to have its membership suspended and isn’t party to the reductions.

"For now, OPEC looks like a functioning cartel, which is bullish for prices," Cavan Yie, senior equity analyst at Manulife Asset Management Ltd. in Toronto, said by telephone. "If they follow through, this should balance the market in the first half of next year. This should be enough to send prices to a $50 and $60, maybe $65, range."

OPEC plans to hold talks with non-OPEC producers on Dec. 9 in Doha. Russia will cut production by as much as 300,000 barrels a day during the first half of 2017, the nation’s Energy Minister Alexander Novak told reporters in Moscow.

"Now the focus is going to be on two things," Glickman said. "First we will be looking to see what compliance will be and then we’ll have to see if U.S. producers step up and fill the gap left by the cut. U.S. producers have become a lot more efficient over the past two years. "

Shale Patch

U.S. crude production increased by 9,000 barrels to 8.7 million barrels a day last week, the highest level since June , according to an Energy Information Administration report on Wednesday. Stockpiles dropped by 884,000 barrels in the week ended Nov. 25.

Higher oil prices and lower drilling costs have made it profitable to drill in some U.S. shale fields, especially the Permian. Rigs targeting crude rose by three to 474 last week, the highest level since January, according to Baker Hughes Inc. data released Nov. 23.

Oil between $50 and $60 is "OPEC’s sweet spot," Yie said. "If it goes higher, a lot more U.S. shale production will come online, which they don’t want."

Oil-market news:

Kinder Morgan Inc. and Enbridge Inc. won Canadian government approval for two pipeline projects, which could potentially expand exports, open new Asian markets and lift prices for locally produced barrels. Weatherford International Plc said it will cut losses by pulling back its U.S. fracking business as long as the work remain unprofitable.

Bloomberg News by Mark Shenk