By Julia-Ambra Verlaine

Oil prices erased earlier losses and closed higher Thursday after signs of discord over supply cuts among the Organization of the Petroleum Exporting Countries and other major producers sparked a volatile trading session.

U.S. crude futures for July delivery closed up 0.3% at $37.41 a barrel. Easing coronavirus lockdowns and historic oil output cuts by large producers have helped spur the recent climb in oil prices -- though they are still down around 40% since the beginning of the year.

Thursday's initial slip followed the cancellation of a hastily called meeting that was supposed to take place Thursday among a 23-country coalition known as OPEC-plus.

"You have to wonder why OPEC+ even brought up the 'special' meeting when it only cast doubt on the existing plan," says Bob Yawger, director of the futures division at Mizuho Securities USA, in a note to clients.

Saudi Arabia, the de facto leader of OPEC, and Russia informally agreed Wednesday to extend supply cuts of 9.7 million barrels a day an extra month through July, revisiting output curbs every month.

Negotiations have been held up by insistence from the Russians and Saudis that countries such as Nigeria, Iraq, and Kazakhstan, which have repeatedly flouted their cut quotas, promise to improve -- or even retroactively correct -- their compliance rates.

"It is unlikely that Iraq and Nigeria, both struggling with a crippling economy, would give up to the kingdom and the Kremlin demands to hike their quotas," said Rystad Energy senior oil markets analyst Paola Rodriguez Masiu in a note. "No wonder why the market is trembling."

Brent crude futures for delivery in August, the global gauge of oil prices, gained 0.5% to close at $39.99 a barrel.

Analysts said the current situation resembles tensions within the OPEC alliance a few months ago. In February, Russia rejected a Saudi-led effort to deepen OPEC's oil-production cuts in response to coronavirus when prices started falling below $60 a barrel.

Thursday's moves came after data released by the U.S. Department of Energy Wednesday showed a jump in gasoline stockpiles and U.S. diesel demand hitting a 21-year low -- indicating that the road to the country's economic recovery may be slower than expected.

Commerzbank AG commodity analysts said the latest inventory build in U.S. gasoline and distillate oil products, including fuel for trucks, happened even more quickly than during the 2008-09 financial crisis.

"This is attributable first and foremost to extremely weak demand, which at 2.7 million barrels a day has fallen to its lowest level since April 1999," said Eugen Weinberg, a senior commodity analyst at Commerzbank AG.

Traders said recent civil unrest in the U.S. is also fueling concerns that the rebound in oil prices could be dented by a second wave of coronavirus infections, after crowds gathered nationwide to protest the killing of George Floyd in police custody.

Write to Julia-Ambra Verlaine at Julia.Verlaine@wsj.com