Oil prices climbed Friday to tally a weekly gain of nearly 4%, as reported progress in U.S.-China trade negotiations eased worries about energy demand, and news of an explosion on an Iranian tanker fed tensions in the Middle East, raising the potential for crude-output disruptions in the region.

West Texas Intermediate crude for November delivery US:CLX19 climbed $1.15, or 2.2%, to settle at $54.70 a barrel on the New York Mercantile Exchange—a two-week high—with the front-month contract ending 3.6% higher for the week.

The global benchmark, December Brent crude UK:BRNZ19 added $1.41, or 2.4%, to $60.51 a barrel on ICE Futures Europe, for a weekly gain of 3.7%. Both benchmarks had posted losses in each of the previous two weeks in a row.

The U.S. and China reached a tentative, partial agreement on Friday that may lead to a truce in the trade war, according to a Bloomberg News report, citing people familiar with the matter. Under the pact, China would agree to some agricultural concessions, while the U.S. would provide some tariff relief, the report said. The news provided an added boost to U.S. stocks, feeding risk-on sentiment that further fueled a rise in oil prices.

Prices had already been moving higher on news of an explosion on an Iranian tanker, which sustained damages after being hit by missiles that were launched from the Saudi Arabian port of Jeddah, according to the state-run IRNA news agency, citing Iran’s National Iranian Tanker Co. The stricken vessel was identified as the Sabity, according to those reports.

Reports of the Iran tanker blast come amid allegations that the country has been behind attacks in recent months on oil tankers close to the Strait of Hormuz, a well-known oil choke point. Officials in the U.S and Saudi Arabia believe Iran was behind a missile attack on Saudi oil facilities last month, though Tehran has denied involvement in any attacks.

“The September 14th drone strikes that temporarily knocked out half of Saudi’s oil production have brought the geopolitical price premium back to the fore,” said Cailin Birch, global economist at The Economist Intelligence Unit. “Prior to those attacks, oil prices had been on a steady downward trend; that episode highlighted that Iran’s tensions with the US, the UK and Saudi have not subsided since July-August, when the initial tanker seizures were announced.”

Hopes for a positive outcome to U.S-China trade talks also helped drive sharp gains for oil prices on Thursday, lifting WTI and Brent crude prices to their highest levels in more than a week.

Read:Baker Hughes data show U.S. oil-rig count up for the first time in 8 weeks

“While news of an Iranian tanker catching fire may uplift oil markets, the main focus ...remains the outcome of trade negotiations in Washington,” Lukman Otunuga, senior research analyst at FXTM, told MarketWatch.

“Oil prices remain heavily influenced by demand-side dynamics revolving around trade uncertainty and global growth concerns,” he said. “Should trade talks disappoint, this may result in oil pushing lower despite rising geopolitical tensions.”

From a technical perspective, “WTI oil is staging a rebound on the daily timeframe, with $55 acting as the first level of interest,” added Otunuga.

Meanwhile, in a monthly report issued Friday, the International Energy Agency said it expects global demand growth of 1 million barrels a day in 2019 and 1.2 million barrels a day, in the following year. IEA attributed the downgrades of roughly 100,000-a-barrel-a-day from previous estimates for demand that has shaped up “to be the weakest since 2016, following evidence of a slowdown in several major consuming regions and countries, including Europe, India, Japan, Korea and the U.S.”

The report comes after the Organization of the Petroleum Exporting Countries, in its monthly report, trimmed its forecast for 2019 world oil-demand growth but left its outlook for 2020 unchanged. At the same time, it cut its outlook for non-OPEC supply growth in 2019 and 2020.

Weak September economic data in the U.S. and European Union has likely helped oil avoid a sharper price increase for now, said Birch. “This will remain the dominant factor influencing oil prices in 2020, as slow growth translates into weaker oil demand growth.”

Still, “we expect tensions in the [Middle East] region to remain high in 2020, which will occasionally erupt into targeted strikes like the ones we have seen in recent months,” she said in emailed comments.

Back on Nymex, November gasoline US:RBX19 added 1% to $1.6388 a gallon, for a weekly gain of around 4.2%, while November heating oil US:HOX19 added 1.9% to $1.9576 a gallon, lifting its weekly rise to 3.3%.

November natural gas US:NGX19 settled at $2.214 per million British thermal units, down 0.2% on Friday, for a weekly loss of 5.9%.

Also see:Water’s cheap, but water-related stocks have heated up this year