Oil prices edged up on Friday, in thin and choppy trade, supported by hopes Greece's upcoming election will not result in an exit from the euro zone, while weak U.S. economic data limited gains.
Both Brent and U.S. crude posted weekly losses, though the U.S. slip was only 7 cents.
Friday's gains were hemmed in by separate reports showing U.S. manufacturing output contracted in May, while factory activity slowed in New York state in June and U.S. consumer sentiment fell.
The weak data raised the possibility that the U.S. Federal Reserve might use more monetary easing to help a sputtering economic recovery. The Fed's policy-making committee has a two-day meeting starting Tuesday.
A weaker dollar, after the euro recovered from early losses against the U.S. currency, also lent some support to oil, along with gains on Wall Street.
U.S. stock indexes and oil also received support from news on Thursday that officials from the G20 nations, whose leaders meet in Mexico next week, said central banks were ready to take steps to stabilize financial markets by providing liquidity if needed in the wake of Greece's election.
"We are waiting for the Greek elections. If there is a conclusive result for a government that wants reform, then there will be a return of risk appetite and oil will resume the upstream trend," said Harry Tchilinguirian, head of commodity market strategy at BNP Paribas.
Brent August crude rose 44 cents to settle at $97.61 a barrel, having swung from $96.97 to 98.10.
Front-month Brent ended six straight lower settlements, but posted a weekly loss of 1.87 percent. Brent's July contract expired on Thursday.
U.S. July crude edged up 12 cents to settle at $84.03 a barrel, ending with a weekly loss of 7 cents.
"At this point, it looks like the markets are frozen and waiting for the results of the Greek elections, which are totally unpredictable," said Dominick Chirichella, senior partner at Energy Management Institute in New York.
Total crude trading volumes were thin. Brent turnover lagged its 30-day average by 39 percent and U.S. crude volume trailed that marker by 25 percent.
U.S. gasoline and heating oil posted more robust gains than either crude oil contract.
Money managers cut their net long U.S. crude futures and options positions in the week to June 12, the U.S. Commodity Futures Trading Commission reported on Friday.
Along with Greece's political turmoil, Iran's talks with major powers about Tehran's nuclear program set to start Monday in Moscow kept traders and brokers cautious, with recently revived talks so far unable to resolve the dispute.