For the week, benchmark crude prices declined, having fallen sharply earlier in the week on demand worries.
Brent crude futures settled 54 cents higher at $62.47 a barrel. West Texas Intermediate crude futures rose 33 cents to end the session at $55.63 a barrel.
Still, WTI dropped 7% for the week and Brent lost about 5.5% for the week, the steepest losses for both benchmarks since late May.
Prices gained late in the session after Iran's Revolutionary Guards said they had captured a British-flagged oil tanker in the Gulf after Britain seized an Iranian vessel earlier this month, further raising tensions along a vital international oil shipping route.
A second oil tanker, the British-operated, Liberian-flagged Mesdar, turned sharply north toward Iran's coast on Friday afternoon after passing westward through the Strait of Hormuz into the Gulf, according to Refinitiv tracking data.
"Our opinion of the complex still favours some wide swinging trade in both directions as pricing continues to be buffeted by an array of cross currents that include a heightening of tensions between the U.S. and Iran on the bullish side and mounting global oil demand concerns on the bearish side," Jim Ritterbusch of Ritterbusch and Associates said in a note.
The episode has injected further geopolitical risk into the oil market.
A senior Trump administration official said on Friday the United States will destroy any Iranian drones that fly too close to its ships.
A day earlier, the United States said a U.S. Navy ship had "destroyed" an Iranian drone in the Strait of Hormuz after the aircraft threatened the vessel, but Iran said it had no information about losing a drone.
Prices were also buoyed Friday by indications the U.S. Federal Reserve will interest cut rates aggressively to support the economy.
Two influential Federal Reserve officials sharpened the public case for acting to support the U.S. economy on Thursday, reviving bets the central bank may deliver a larger-than-expected cut this month, although bets on a larger rate cut were pared back on Friday.
Meanwhile, U.S. energy firms this week reduced the number of oil rigs operating for a third week in a row as drillers follow through on plans to cut spending.
Drillers cut five oil rigs in the week to July 19, bringing the total count down to 779, the lowest since February 2018, General Electric Co's Baker Hughes energy services firm said in its closely followed report on Friday. <RIG-OL-USA-BHI>
Data on Friday also showed hedge funds and other money managers raised their bullish wagers on U.S. crude. It was the second consecutive increase. [CFTC/]
MAP: Iran's guards say they seized a foreign oil tanker in the Gulf -
Still, the longer-term outlook for oil has grown increasingly bearish.
The International Energy Agency (IEA) does not expect oil prices to rise significantly because demand is slowing and there is a glut in global crude markets, the IEA's Fatih Birol said on Friday in public comments.
The IEA is reducing its 2019 oil demand growth forecast to 1.1 million barrels per day (bpd) from 1.2 million bpd due to a slowing global economy amid a U.S.-China trade spat, Birol told Reuters in an interview on Thursday.
"Macroeconomic concerns, uncertainty on trade discussions and increasing oil supply from the U.S. continued to weigh on sentiment," said Warren Patterson, head of commodities at ING.
(Reporting by Stephanie Kelly and Devika Krishna Kumar in New York; Additional reporting by Dmitry Zhdannikov in London, Aaron Sheldrick in Tokyo and Koustav Samanta in Singapore; editing by Chizu Nomiyama and Leslie Adler)
By Stephanie Kelly and Devika Krishna Kumar