×

US oil settles up $1.07, or 2.80%, at $39.31 a barrel

Getty Images

Oil closed up about 3 percent on Tuesday as oversold conditions brought some buyers back to the market, but a lingering supply glut and worries about the slowing economy in top commodities consumer China kept crude prices near 6-1/2-year lows.

U.S. crude settled up $1.07, or 2.80 percent, at $39.31 a barrel, advancing from $37.75, its lowest since February 2009 set in the previous session.

Brent gained turned positive in the extended-hours session, gaining about 2 percent, on a surprise drop in crude inventories. API crude inventories fell by 7.3 million, versus StreetAccount forecasts for a rise of 2.48 million.

Read MoreWhy energy stocks might be a bottom buy here

Futures of U.S. crude and Brent, the global oil benchmark, are both down more than 16 percent on the month. About half of those losses were incurred in the past two sessions as plummeting Chinese equities sparked a selloff across global markets.

China cut interest rates on Tuesday and lowered the amount of reserves banks must hold in its latest move to stimulate growth, aiding a recovery in European and Wall Street shares.

"We're practically oversold on oil at this moment and we can't keep going down in a straight line," said Tariq Zahir, managing member at Tyche Capital Advisors in Laurel Hollow, New York. "That said, I wouldn't hold my breath on a proper recovery yet."

The market braced for more losses in crude on expectations that U.S. crude stockpiles rose again last week amid refinery outages. Early estimates in a Reuters poll showed a build of 2.2 million barrels, adding to the previous week's 2.6 million-barrel build.

Industry group American Petroleum Institute will issue its own stockpile report at 4:30 p.m., before Wednesday's official data from the U.S. Energy Information Administration.

Read MoreGartman: I'm on the sidelines on oil ... for now

Adding to glut concerns, OPEC member Iran said it would increase crude production and reclaim its lost export share once nuclear-related sanctions on Tehran are lifted.

U.S. gasoline futures, kept a lid on crude's recovery, tumbling more than 2 percent to seven-month lows due to the restart of a key Midwest refinery unit and the approaching end of the summer driving season.

Some analysts expect further deterioration in China's growth and also a U.S. rate hike by the year-end that could add to the dollar's rally, putting more weight on commodities.

Read MoreWill they or won't they? Nerves fray over potential OPEC cut as oil gets routed

"That puts further cracks into the two main growth pillars for the world economy of recent years: Chinese demand (including commodities) and easy money," HSBC's co-head of Asian economics research Frederic Neumann said.

Goldman Sachs said that while China's turmoil would not lead to a global recession, it did expect Beijing's economic troubles to result in weak commodities.