U.S. stocks rose modestly on Wednesday, with energy companies leading the advance as oil prices jumped to a 3 1/2-year high.

The energy gains came as traders digested President Donald Trump’s decision a day earlier to pull the U.S. out of the Iran nuclear deal and resume sanctions against the oil-producing nation. However, uncertainty over the broader fallout to the decision could limit gains.

What are markets doing?

The Dow Jones Industrial Average DJIA rose 37 points, or 0.2%, to 24,399. The S&P 500 SPX gained 6 points to 2,678, a gain of 0.3%. The Nasdaq Composite Index COMP added 10 points, or 0.1%, to 7,277.

Energy shares jumped 1.7%, by far the biggest outperformer among the 11 primary S&P 500 sectors. Material stocks rose 0.6% while industrial names were up 0.4%.

What is driving the market?

A rally in oil prices helped lift U.S.-listed energy companies in premarket action, which pushed stock-index futures higher. West Texas Intermediate oil CLM8 jumped 2.6% while Brent LCON8,  was up 2.5%. Trump said the U.S. intends to impose sanctions on Iran, curbing the country’s oil exports and tightening global oil supply.

The jump in oil coincided with a rise in Treasury yields, as rising energy prices can lift inflation expectations, which are bearish for bonds that have a fixed value. Rising inflation also could put pressure on the Federal Reserve to raise interest rates more aggressively. The yield on 10-year U.S. notes TMUBMUSD10Y, +0.60%  rose back above 3%. The dollar DXY, -0.05%  was higher earlier in the premarket session, but edged lower, off 0.1% at 93.04, as the opening bell approached.

What are strategists saying?

“The [Iran] decision is likely to curb global oil supplies and put upward pressure on oil prices. Iran is OPEC’s third-largest producer, with production fluctuating around 3.8 mbpd [million barrels a day] in recent months and exports of between 2 and 2.5 mbpd,” said Mark Haefele, chief investment officer at UBS, in a note.

 “We believe equity markets can withstand modestly higher oil prices. A boost to oil firms, which account for 7% of the MSCI All Country Index, should help offset the downside for other companies from higher input costs and the negative effects on consumer disposable incomes from higher fuel bills,” Haefele said.

Stock movers

Among oil companies on the rise, Exxon Mobil Corp. XOM added 1.8%, Chevron Corp. CVX climbed 2%, and Devon Energy Corp. DVN picked up 2.5%.

Both Boeing Co. BA and General Electric Co. GE could also be volatile following Trump’s decision on Iran. Boeing stands to lose roughly $20 billion in business with the country as a result of the withdrawal, which pledges to punish businesses doing transactions in Iran. GE, which makes aviation parts, could also be impacted. Boeing rose 0.1% in early trading while GE was up 0.9%. Both stocks are Dow components.

Dow component Walt Disney Co. DIS fell 1.4% even after its earnings out late Tuesday beat forecasts. Its results were boosted by performance at its movie-studio arm after the huge success of “Black Panther.”

Walmart Inc. shares WMT fell 3% after the retail giant said it was taking control of India’s largest e-commerce company, Flipkart Group, for $16 billion, as the Bentonville, Ark.-based company tries to fend off Amazon.com Inc. AMZN at home and abroad.

TripAdvisor Inc. TRIP soared 19%. The online travel-booking service late Tuesday released results that topped Wall Street estimates.

Groupon Inc. GRPN jumped 10% after it unexpectedly reported an adjusted profit and revenue that fell less than expected.

Electronic Arts Inc. EA climbed 2.3%, boosted by positive analyst commentary following its quarterly results.

Shares of Monster Beverage Corp. MNST sagged 6.8% a day after it posted earnings below forecasts.

Shares of Papa John’s International Inc. PZZA fell 6.4%. The pizza chain late Tuesday reported a decline in quarterly sales.

U.S.-listed shares of Anheuser-Busch InBev SA BUD rose 1.8% after the European brewer released results.

Shares of ADT Inc. ADT tumbled 10%, a day after the home-security company reported its first-quarter results.

Coty Inc. COTY jumped 3.3% after it reported adjusted third-quarter earnings that topped expectations, along with better-than-expected revenue.

Mylan NV MYL rose 0.7%. It reported first-quarter earnings that came in below analyst forecasts.

And after the market closes, Roku Inc. ROKU, 21st Century Fox Inc. FOXA and IAC/InterActiveCorp. IAC are slated to report.

What’s on the economic calendar?

The producer-price index rose 0.1% in April, below forecasts. The core PPI was also up 0.1%.

Wholesale inventories numbers from March are scheduled for release at 10 a.m. Atlanta Federal Reserve President Raphael Bostic is expected to give a speech on the economy and policy outlook the River Club in Jacksonville, Fla., at 1:15 p.m.

What are other markets doing?

Asian markets closed mixed, while European stock SXXP benchmarks mainly traded higher. Gold prices GCM8 were down 0.7% at $1,305.30.

Article originally published by Sara Sjolin and Ryan Vlastelica at marketwatch.com