Strength in the U.S equities market and data showing US energy firms this week reduced the number of oil rigs operating for the first time in three weeks helped support oil prices.
Each of the major US stock indexes finished at a record closing high, as expectations grew that the Federal Reserve would take a more dovish turn as a raft of data provided more evidence of a slowing economy.
US oil drillers cut five oil rigs in the week to July 3, bringing the total count down to 788, General Electric Co's Baker Hughes energy services firm said in its closely followed report. Record US crude production has pressured prices over the past year.
September Brent crude futures ended the session up $1.42, or 2.3pc, at $63.82 a barrel. US crude futures for August delivery settled up $1.09, or 1.9pc, at $57.34 a barrel. On Tuesday, both benchmarks fell more than 4pc on worries about a global economic slowdown.
Gains were pared after data showed US crude inventories fell by 1.1 million barrels in the latest week, much less than the 3-million-barrel decrease analysts had expected.
"The market is disappointed by a very small crude oil inventory draw. ... The only sign of strength in the market is the continued modest decline of gasoline inventories," said Andrew Lipow, president at Lipow Oil Associates in Houston.
US gasoline futures led the energy complex, rising about 2.5pc to settle at $1.9167 a gallon.
"We had a pretty sharp correction yesterday, so after that a little rebound is expected. Globally, the market is concerned about oil demand growth potential," Olivier Jakob of Petromatrix consultancy said.
Trading volumes were subdued ahead of the US Fourth of July holiday on Thursday. About 573,076 lots of the front-month US crude futures contract were traded by 2:45 p.m. ET (1845 GMT), some 65.2 percent of the previous session's volume.
On Tuesday, the Organization of the Petroleum Exporting Countries and other producers such as Russia, a group known as OPEC+, agreed to extend oil supply cuts until March 2020.
"Extending the cut by six or nine months, it doesn't really matter if the level stays the same," Jakob said. "If you really wanted to target stock levels, you would need deeper cuts but Saudi Arabia has already gone beyond its cut target."
The OPEC+ agreement should draw down oil inventories in the second half, boosting oil prices, analysts from Citi Research said in a note.
"Keeping cuts through the end of 1Q aims to avoid putting oil into the market during a seasonal low for demand and refinery runs," they said.
Still, signs of a global economic slowdown hitting oil demand worried investors after global manufacturing indicators disappointed and the United States threatened Europe with more tariffs.
The US trade deficit jumped to a five-month high in May and the ADP National Employment Report showed private payrolls increased far less than economists had expected.
Barclays expects oil demand to grow at the slowest pace since 2011. Morgan Stanley lowered its long-term Brent price forecast to $60 per barrel from $65 per barrel, and said the oil market is broadly balanced.
Crude prices also were pressured by signs of a recovery in oil exports from Venezuela in June and growth in oil production in Argentina in May.