By Sarah McFarlane and Jenny W. Hsu

Crude futures surged Wednesday on growing optimism that the Organization of the Petroleum Exporting Countries would agree on a deal to cut oil production later in the day.

The cartel is close to a deal, according to people familiar with the matter, and has reached a consensus to cut production to 32.5 million barrels a day. It is still trying to resolve an Iraq data dispute.

Prices remained volatile, and many analysts continue to doubt that if a deal were struck it would be properly enforced or would even be enough to address a supply imbalance that has pressured this market for over two years.

The February contract in Brent crude, the global oil benchmark, gained 7.6% to $50.91 a barrel on London's ICE Futures exchange, according to FactSet. On the New York Mercantile Exchange, West Texas Intermediate futures surged 7.3% at $48.55 a barrel, FactSet said.

Prices jumped after Iran's oil minister, Bijan Zanganeh, said ahead of crunch talks in Vienna that he believed OPEC would reach a deal, though he said an immediate freeze of his country's output wasn't on the agenda.

Talk of OPEC reaching a deal has dominated the oil market for much of the year, as geopolitical maneuvering by key producing nations stopped the cartel from tackling the global oversupply.

"The communication this morning is extremely positive from Iran," said Bjarne Schieldrop, a commodities analyst from Sweden's SEB bank, adding that the market was volatile ahead of the meeting's outcome.

Iran's willingness to participate in some way -- a long-held Saudi demand --signals a greater likelihood that all OPEC members will agree to a deal.

A successful OPEC accord is also crucial in getting non-OPEC producers -- such as Russia -- to slash production in a collective effort to lift global oil prices. Russia has said it wouldn't make any commitment until an agreement was forged by OPEC members.

In the past year, OPEC leaders have tried several times to agree on production curbs, but these attempts have failed, causing high volatility in oil markets.

Tension between Iran and Saudi Arabia has also been a sticking point. Even though Iran has relaxed its position by agreeing to hold production levels steady -- a step back from a previous demand to keep pumping -- it remains to be seen whether Saudi Arabia will be satisfied.

"The fact that geopolitical rivals, Saudi Arabia and Iran, appear to have problems resolving their differences on the allocation of any cartel-wide production cuts seems to be the major stumbling block to any agreement," said Barnabas Gan, an economist at OCBC bank in Singapore.

Iraq, OPEC's second-largest producer after Saudi Arabia, also wants to be excluded from a deal, saying it would only go as far as capping production at present levels. Iraq says it needs the oil revenue to fund its war against Islamic State.

If OPEC fails to reach an agreement, a "blame game" could ensue, with Saudi Arabia pointing fingers at Iran and Iraq for being unwilling to compromise, said Tim Evans, a Citi Futures analyst.

Market players have gotten used to disappointment from OPEC.

"This apparent stalemate has seen investors take an increasingly bearish view on oil prices," said ANZ Research. ANZ added that despite the squabbling, OPEC is under growing pressure to deliver a deal to protect its relevance.

As they waited for news, analysts and investors debated how the market would react to a productiondeal.

Commerzbank predicted a "small" cut of 700,000 barrels a day, which would keep the oil price around $50.

If OPEC cuts around 1 million barrels a day, as the market currently expects, that could push prices into the mid $50s and toward $60 in 2017, said Richard Mallinson, analyst at consulting firm Energy Aspects.

BNP Paribas predicted cuts of between 1 million and 1.5 million barrels that would boost the price to just above $50.

If OPEC fails to agree on cuts, that would send crude plunging to $40 a barrel, Commerzbank said.

Nymex reformulated gasoline blendstock -- the benchmark gasoline contract -- rose 3.6% to $1.43 a gallon. ICE gasoil changed hands at $445.75 a metric ton, up $20.25 from the previous settlement.

Write to Sarah McFarlane at sarah.mcfarlane@wsj.com and Jenny W. Hsu at jenny.hsu@wsj.com

(END) Dow Jones Newswires

November 30, 2016 09:00 ET (14:00 GMT)

Copyright (c) 2016 Dow Jones& Company, Inc.