Oil futures rose 1% on Friday, with U.S. crude up more than 9% in the week and global benchmark Brent gaining 5%, on fears the United States could attack Iran and disrupt flows from the Middle East, which provides more than a fifth of the world's oil output.
U.S. gasoline futures, meanwhile, jumped around 4% following a massive fire at Philadelphia Energy Solutions' refinery in Philadelphia, the largest on the U.S. East Coast.
"The heightening of tensions between the United States and Iran has evolved as primary price motivator in spiking oil values," Jim Ritterbusch of Ritterbusch and Associates said in a note.
While the rise in U.S.-Iranian tensions has largely driven the crude price gains, analysts said an early July meeting of the Organization of the Petroleum Exporting Countries (OPEC) and its allies to reassess production targets, a potential softening of trade tensions between the United States and China and the refinery fire were also supporting prices.
Brent futures were up 69 cents, or 1.1%, to $65.14 a barrel, while the most active U.S. West Texas Intermediate (WTI) crude contract settled up 0.6% at $57.43.
That put Brent on track to gain about 5% for the week, its first weekly gain in five weeks, and WTI to jump more than 9%, which is its biggest weekly percentage gain since December 2016.
The U.S. benchmark surged 5.4% and Brent jumped 4.3% on Thursday after Iran shot down a drone that the United States claimed was in international airspace and Iran said was over its territory.
U.S. President Donald Trump said he had aborted a military strike on Iran because such a response to Tehran's downing of the unmanned U.S. surveillance drone would have caused a disproportionate loss of life.
Iranian officials told Reuters that Tehran had received a message from Trump through Oman overnight warning that a U.S. attack on Iran was imminent.
The officials said they had responded by saying that any attack would have regional and international consequences. They also said Supreme Leader Ayatollah Ali Khamenei was against talks but that they would convey the U.S. message to him.
Trump spoke on Friday to Saudi Crown Prince Mohammed bin Salman about Middle East stability and the oil market, the White House said, after tensions with Iran prompted a rise in oil prices.
Tensions have been on the rise since U.S. sanctions on Iran severely reduced oil exports from OPEC's third largest producer and as Washington has blamed Tehran, which denies any role, for a series of attacks on oil tankers in the Gulf.
"There is no doubt that a severe disruption to the transit of oil through this vulnerable route would be extremely serious," said consultancy FGE Energy in a note.
The demand-side outlook has also improved, with appetite for risk assets rising after the European and the U.S. central banks signalled possible rate cuts this week.
A weaker dollar also supported oil prices, making crude, usually priced in dollars, cheaper for buyers with other currencies.
Another macroeconomic factor supporting prices is the plan by Beijing and Washington to resume talks to resolve a trade war that has hit economic growth prospects.
"Trade anxiety has died down, pushing energy prices higher as global growth will not be pressured by a prolonged tariff war," said Alfonso Esparza, senior market analyst at OANDA.
Concern about slowing economic growth and a U.S.-China trade dispute had pulled oil lower in recent weeks. That came after Brent reached a 2019-high above $75 in April.
U.S. energy firms added one rig this week, increasing the number of oil rigs operating for the first time in the past three weeks. The rig count, however, is on track to decline for a seventh month in a row in June as drillers cut spending to focus more on earnings growth instead of increased output.