U.S. stocks recovered from overnight losses to post solid gains, with the Nasdaq notching a new record close, after remarks by President Trump suggested the U.S. and Iran were refraining from further military action following attacks on U.S. bases overnight, in retaliation for last week’s killing of Maj. Gen. Qassem Soleimani by American forces.

However, the Dow’s gains were somewhat restrained by a fall in Boeing shares after one of the planemaker’s jets operated by Ukraine International Airlines crashed shortly after takeoff from Tehran on Wednesday.

How are benchmarks performing?

The Dow Jones Industrial Average DJIA, -0.46% ended the session up 161.41 points, or 0.6%, to 28,745.09, the S&P 500 index SPX, -0.84% gained 15.87 points, or 0.5%, to close at 3,253.05, and the Nasdaq Composite Index COMP, -1.26% finished up 60.66 points, or 0.7%, at 9,129.24.

The S&P set a new intraday record Wednesday, while the Nasdaq set both record intraday high and close.

Read:What stock market investors need to know about intensifying U.S.-Iran tensions

What’s driving the market?

Investor sentiment was buoyed following remarks by President Trump, who responded to Tuesday night’s attacks by Iran by minimizing their importance, saying that no U.S. casualties were sustained and that only ‘minimal’ damage was done to U.S. military facilities in Iraq.

“Iran appears to be standing down, which is a good thing for all parties involved, and a very good thing for the world,” the president said during an address from the White House Wednesday morning.

The President did say, however, that he was imposing further economic sanctions on Iran, while stating categorically that “As long as I’m President of the United States, Iran will never be allowed to have a nuclear weapon,” hinting at the possibility of further U.S. strikes in the wake of an announcement by Iran that it had surpassed the limits on stockpiles of low-enriched uranian set by the 2015 nuclear deal which President Trump abandoned.

Mideast tensions were in focus after Iran delivered what is being described as a measured response to the killing of a top general by the American forces last Friday. Iranian Supreme Leader Ayatollah Ali Khamenei vowed further retaliation for the U.S.’s killing of Soleimani, hours after striking military bases in Iraq that house U.S. forces, The Wall Street Journal reported.

Tehran’s military response, firing more than a dozen missiles at U.S. military bases in Iraq at Al Asad and Erbil, briefly rattled financial markets in after-hours trade, but the moves in stocks, bonds, and commodities quickly moderated as investors reassessed the chances of a broader conflict.

Fears were tempered by tweets from Iran’s foreign minister, Javad Zarif, who said via Twitter that Iran didn’t seek further escalation, but would “defend ourselves against any aggression.”

“Markets initially reacted [to the attacks] in classic risk-off fashion, with Asian stock markets getting hammered and Wall Street futures falling sharply, as safe havens such as the Japanese yen and gold roared higher,” wrote Marios Hadjikyriacos Investment Analyst at XM, in a Wednesday note.

“Yet, these moves retraced in the following hours,” he added. “Much of this market serenity is owed to both sides signaling they don’t want to escalate matters any further.”

Meanwhile, investors parsed U.S. private-sector employment data from payroll firm Automatic Data Processing Inc., which estimated that employers added 202,000 new jobs in December, above the 157,000 expected by analysts polled by Econoday.

Which stocks were in focus?

Shares of Boeing BA, +0.04% closed 1.8% lower after a 737 airplane—not the 737 MAX aircraft that crashed twice and has been grounded—suffered a fatal crash shortly after takeoff in Tehran en route to Kyiv, Ukraine, killing all 167 passengers and nine crew members on board. Boeing’s losses were responsible for a roughly 40-point drag on the Dow Jones Industrial Average.

Lennar Corp.’s stock LEN, -0.95% rose 0.8% after it released better-than-forecast fiscal fourth-quarter results.

Shares of Walgreens Boots Alliance Inc. WBA, +2.56% ended the session down 5.8% Wednesday, after the pharmacy chain’s fiscal first-quarter earnings fell more than analysts expected, while sales growth also fell short.

Constellation Brands Inc. STZ, -0.51% also reported results Wednesday morning, with fiscal third-quarter revenue and earnings rising more than Wall Street forecasts. The beer, wine and spirits company also raised its outlook for the full year, and it’s stock rose 3.6% Wednesday.

Macy’s Inc. M, -1.71% shares gained 2.4% Wednesday, after the department-store retailer reported sales results for the holiday period of November and December.

How are other markets trading?

Oil futures erased big gains overnight to settle significantly lower. West Texas Intermediate crude for February delivery US:CLG20 fell $3.09, or 4.9%, to settle at $59.61 a barrel on the New York Mercantile Exchange, after the U.S. benchmark oil settled 0.9% lower on Tuesday.

As geopolitical tensions eased, February gold US:GCG20 fell $14.10, or 0.9%, to settle at $1,560.20 an ounce on Comex.

The yield on the 10-year U.S. Treasury note TMUBMUSD10Y, 0.690% gained 3.4 basis points to 1.857% during Wednesday trade.

The U.S. dollar gained 0.3% to 97.30, versus a basket of six international currencies as measured by the ICE U.S. Dollar Index DXY, -0.15% .

In Asia overnight, the CSI 3000 000300, +2.25% closed 1.1% lower, while Japan’s Nikkei 225 NIK, +0.17% lost 1.6%. Hong Kong’s Hang Seng HSI, +0.50% shed 0.8%.