By Nicole Friedman 

Oil prices pared losses Tuesday but held near multi-month lows on concerns about a growing glut of crude oil and turmoil in the Chinese stock market.

Light, sweet crude for August delivery fell 39 cents, or 0.7%, to $52.14 a barrel on the New York Mercantile Exchange. Brent, the global benchmark, rose 5 cents, or 0.1%, to $56.59 a barrel on ICE Futures Europe.

Earlier in the session, both contracts traded at their lowest intraday prices since April.

On Monday, prices posted their largest declines since February on concerns about a continued oversupply of crude. Output from the U.S. and the Organization of the Petroleum Exporting Countries has increased in recent months, surprising some investors who had expected production to decline as low oil prices prompted producers to slash spending on new production. Though demand has also risen sharply, some market watchers say that consumption won't be enough to eat away at the global glut of crude oil until 2016.

The U.S. Energy Information Administration said Tuesday that U.S. production fell from a 44-year high in May and is expected to keep declining through February 2016. Even so, the agency expects global supplies to exceed consumption this year and next.

Recent data showing higher-than-expected oil supplies, along with concerns about the crisis in Greece and the stability of China's stock market, have prompted some traders to pull back from bullish bets on oil. Money managers, including hedge funds, cut their aggregate bet on rising oil prices in the week ended June 30 to the smallest since April, according to the Commodity Futures Trading Commission.

"It's been three days of can't-catch-your-breath," said Michael Hiley, an energy trader at brokerage LPS Partners Inc., adding that traders got caught off-guard and had to close out positions once prices broke out of the narrow band they had traded in for several weeks.

"We were sort of stuck in a range for two months and then it's gone," Mr. Hiley said. "It's hard to pick a bottom here."

Gyrations in the Chinese stock market have weighed on a variety of commodities, including copper and iron ore, which rely on Chinese consumption. Chinese stock indexes are down more than 25% from highs reached in June. China is the No. 2 consumer of crude oil.

"The incremental buying that has kept the oil market in a pretty solid condition has been Chinese buying," said Scott Shelton, broker at ICAP PLC. "I don't think that we're selling off because of oil. I think we're selling off because oil's a part of an asset class that will suffer should the Chinese stock market continue to melt down."

Talks between Iran and six world powers were extended past Tuesday night's deadline to July 10. Many market participants expect a final deal with Iran to be reached, which would likely weigh on oil prices. A deal would lead to the lifting of sanctions on Iran's oil exports, allowing the country to sell more crude into an already-oversupplied global market.

ClearView Energy Partners LLC said in a note to clients that it sees an 80% chance that negotiations will conclude by July 10. If a mid-July deal is reached, ClearView said, it sees Brent prices in the fourth quarter of 2016 around $57.50 a barrel, compared with the U.S. government's $67 forecast. If no deal is reached, ClearView sees Brent at $70 a barrel in the fourth quarter of next year.

Gasoline futures rose 1.5% to $1.9530 a gallon. Diesel futures fell 0.2% to $1.7056 a gallon.

Write to Nicole Friedman at nicole.friedman@wsj.com

Subscribe to WSJ: http://online.wsj.com?mod=djnwires