Oil prices bounced from three-week lows on Tuesday, with U.S. refined fuels markets leading the rally on bets for strong summer demand, even as Greece's move toward a debt default threatened to jolt global markets.
Brent crude futures were in line, however, for a second straight monthly loss despite a 10 percent gain for the first half of the year. U.S. crude futures were up similarly for the half year after a loss for June.
Continue Reading Below
But crude futures also had a sterling quarter, with Brent notching its largest gain since 2012 and U.S. crude its strongest since December 2012.
Front-month U.S. gasoline and ultra-low sulfur diesel futures that expire on Tuesday rallied about 2 percent or more, helping lift crude futures as traders and investors squared positions ahead of the month- and quarter-end.
"Crack spread buyers are helping," said Donald Morton, who runs an energy-trading desk at Haverhill, Massachusetts for investment bank Herbert J. Sims & Co.
The crack spread is the differential between the price of crude and the petroleum products extracted from it, or the profit margin refiners can get for refining crude.
The gasoline crack (CL-RB1=R) widened sharply for the first time in three days while that for ULSD (CL-HO1=R) hit a June 19 high.
Brent futures were up 85 cents, or 1.5 percent, at $63.72 a barrel by 11:30 a.m EDT (1530 GMT). For the month, Brent fell 4 percent. For the quarter, it rose 14 percent and for the year-to-date, it was up 10 percent.
U.S. crude rose by 50 cents, or nearly 1 percent, to $58.83. It slipped 2 percent for the month, rose 25 percent for the quarter and 10 percent for the year.
Greek government sources have said the country will default on a crucial repayment due to the International Monetary Fund later on Tuesday, plunging it deeper into financial crisis.
"Markets are worried that a Greek debt default could hit European economic growth and thus fuel demand," said Tamas Varga, oil analyst at London brokerage PVM Oil Associates.
Investors also kept a close eye on talks in Vienna on Iran's nuclear program that could end years of economic sanctions on the Islamic Republic and eventually allow a big increase in Iranian oil exports.
The U.S. delegation to the negotiations said the terms for an interim nuclear deal with Iran has been extended to July 7, from June 30 originally, to allow more time to reach a final accord. (Additional reporting by Christopher Johnson in London and Aaron Sheldrick in Tokyo; Editing by Marguerita Choy)