U.S. stocks ended mostly higher on Monday, led by gains in the Nasdaq and chipmakers as investors sought bargains after Friday’s sharp selloff. Canada’s ⁠main stock ​index also clawed back some of Friday’s decline, with energy and technology shares leading gains.

Investors were also relieved after Iran and Israel said they had halted ⁠attacks on ​each other. The halt followed an appeal from U.S. President Donald Trump that they immediately “stop shooting.” The attacks over 24 hours were the most direct confrontation between Iran and Israel since an April ceasefire in the war.

The Dow ended lower and stocks overall closed off the day’s highs.

Apple shares eased late and finished 1.9% lower even as the company ​unveiled a series of AI upgrades to Siri at its annual Worldwide Developers Conference.

Investors may be having a “sell-on-the-news” response, said Bruce Zaro, managing director at Granite Wealth Management in Plymouth, Massachusetts.

“Perception has been for quite some time that Apple had been behind the curve as far as their AI offerings. That’s why the stock widely underperformed many of the other big techs for some time until recently,” he said.

S&P 500 technology led sector ‌advancers, rising 1.5%, and the Philadelphia SE Semiconductor Index jumped 5.6%, rebounding from Friday’s losses that wiped out more than US$1 trillion in market value for U.S.-listed chipmakers. Also, Intel shares gained 11.2% after news website the Information reported that Alphabet’s Google had placed an order to manufacture more than 3 million tensor processing units in 2028.

“Today looks like a day where investors are doing a little bit of bargain hunting off the big tech ‌selloff,” said Rick Meckler, ​partner at Cherry Lane Investments, a ‌family investment office in New Vernon, New Jersey. “What normally happens after that is you get analysts coming in and reiterating ​buys.”

He added: “This market has been priced for quite a while for perfection, and ⁠these are certainly imperfect times. In that environment, you are going to see some back-and-forth, and some fear ⁠of prices having gone too far.”

Stocks sold off on Friday after hitting a series of record highs recently. Underwhelming results from chipmaker Broadcom last week ​had raised concerns that the chip sector was growing too fast, while much stronger-than-expected jobs data for May contributed to Friday’s rout, as traders priced in interest rate increases this year. Broadcom gained 2.8%.

The Dow Jones Industrial Average fell 80.77 points, or 0.16%, to 50,786.01, the S&P 500 gained 21.99 points, or 0.30%, to 7,405.73 and the Nasdaq Composite gained 220.23 points, or 0.86%, to 25,929.66.

The Toronto Stock Exchange’s ​S&P/TSX composite index ended up 65.29 points, or ‌0.2%, at 34,478.74, after posting on Friday its biggest decline in nearly four months.

The TSX energy sector rose 1.6% as the price of oil settled 0.8% higher ⁠at US$91.30 a barrel. Technology was up 0.9%, with shares of electronic equipment company Celestica Inc adding 3.8%. Heavily weighted financials added 0.4%.

Other big tech advancers on Wall Street included Marvell Technology, which jumped 9.6% as the ​chipmaker was set to join the benchmark S&P 500 before the start of trading on June 22.

SpaceX’s initial public offering on Friday could prove a major test for U.S. stock markets, with investors wary of ⁠possible overexuberance.

Among other U.S. stocks, Eli Lilly gained 1.6% after ⁠the drugmaker’s trial results showed its next-generation obesity drug, retatrutide, curbed sleep apnea severity in addition to boosting weight loss and helping knee pain.

Declining issues outnumbered advancers by ‌a 1.01-to-1 ratio on the New York Stock Exchange. There were 129 new highs and 162 new lows on the NYSE. On ​the Nasdaq, 2,746 stocks rose and 2,142 fell as advancing issues outnumbered decliners by a 1.28-to-1 ratio. The S&P 500 posted 13 new 52-week highs and 7 new lows while the Nasdaq Composite recorded 105 new highs and 164 new lows.

Volume on U.S. exchanges was 19.50 billion shares, compared with the roughly 20.3 billion average for the full ​session over the last 20 trading days.

Reuters, Globe staff

Follow related authors and topics

Authors and topics you follow will be added to your personal news feed in Following.

Interact with The Globe