Canada’s main stock index reversed early losses to close higher on Wednesday following choppy trading, as growth sectors including technology and cannabis rose, offsetting declines in utilities and materials. Wall Street ended higher as well, lifted by gains in Nvidia and other tech stocks, while Gap and Nordstrom shares tumbled following weak quarterly reports.

Nordstrom tumbled 29% and Gap slid 24%, after the two retailers reported weak quarterly results and warned of supply chain problems ahead of the crucial U.S. holiday shopping season.

Nvidia rallied 2.9% as it bounced back from a selloff in Big Tech stocks early this week. The graphics chipmaker is now up about 150% in 2021.

Story continues below advertisement

The Toronto Stock Exchange’s S&P/TSX composite index closed up 94.66 points, or 0.4%, at 21,548.43, led by technology and healthcare, which rose 1.8% and 1.7%, respectively.

Cloud-based learning management provider Docebo Inc was the biggest gainer, rising 6%, with Lightspeed Commerce and Shopify Inc also among the top 10 stocks on the index.

“How Shopify goes, so goes the TSX,” said Barry Schwartz, chief investment officer at Baskin Wealth Management.

Shopify, Canada’s most valuable company, recovered after two days of losses when it got caught up in a sell-off of high-growth stocks after Jerome Powell’s nomination for a second term as Federal Reserve chair boosted expectations of early U.S. monetary policy tightening.

Story continues below advertisement

“It’s clear the growth names have been beaten up and sold off indiscriminately all because of a few basis points’ increase in the 10-year” bond yield,” Schwartz said.

Cannabis producer Organigram Holdings was the second-best performer, rising 5.4% and adding to Tuesday’s 8.9% gains on better-than-expected quarterly revenues.

Energy stocks bucked a 0.3% decline in energy prices to rise 1.8% to the highest close since April 2019.

That helped offset declines in consumer stocks, utilities and materials.

Story continues below advertisement

Alimentation Couche-Tard was the biggest loser on the index - falling 4.59% - after the convenience store chain operator reported a decline in quarterly profits from a year ago.

Miners including New Gold, Osisko Mining and Kinross Gold were among the 10 worst performers, with spot gold marginally lower.

On Wall Street, the S&P 500 spent much of the session near flat before climbing just before the close.

The S&P 500 consumer discretionary sector index rose 0.2% after data showed U.S. consumer spending increased more than expected in October.

Story continues below advertisement

The so-called core PCE price index, the Federal Reserve’s preferred inflation measure, also accelerated in October.

Various Federal Reserve policymakers said they would be open to speeding up elimination of their bond-buying program and move more quickly to raise interest rates if high inflation held, minutes of the U.S. central bank’s last policy meeting showed.

Other data showed weekly jobless claims fell and third-quarter GDP was revised higher, while a University of Michigan survey showed consumer sentiment improved in November.

Coronavirus infections broke records in parts of Europe on Wednesday, with investors worried the continent was again the epicenter of a pandemic that has prompted new curbs on movement.

So far this week, the Nasdaq is down about 1.3%, with investors worried that higher interest rates could hurt the valuations of tech and other growth stocks.

Story continues below advertisement

“Equities are under pressure from a combination of rising interest rates, more cautionary news on the earnings front, and also from COVID developments in Europe,” said Greg Bassuk, chief executive at AXS Investments in Port Chester, New York.

The U.S. stock market will be closed on Thursday for the Thanksgiving holiday, and it will have a shortened session on Friday.

Real estate led among 11 S&P 500 sector indexes with a gain of 1.3% for most of the session.

The Dow Jones Industrial Average fell 0.03% to end at 35,804.38 points, while the S&P 500 gained 0.23% to 4,701.46.

The Nasdaq Composite climbed 0.44% to 15,845.23.

Story continues below advertisement

Volume on U.S. exchanges was 8.9 billion shares, light compared to the 11 billion average over the last 20 trading days.

Tesla Inc rose as much as 0.6%. In his latest of several recent share sales, CEO Elon Musk sold 934,091 shares of the electric vehicle maker worth $1.05 billion after exercising options to buy 2.15 million shares.

PC makers HP Inc and Dell Technologies jumped 10% and 4.8%, respectively, after they logged a more than four-fold rise in quarterly profits amid increasing demand for personal computers.

Advancing issues outnumbered declining ones on the NYSE by a 1.15-to-1 ratio; on Nasdaq, a 1.47-to-1 ratio favored advancers.

The S&P 500 posted 27 new 52-week highs and 4 new lows; the Nasdaq Composite recorded 55 new highs and 234 new lows.

Read more: Stocks that saw action on Wednesday - and why

Reuters, Globe staff

Be smart with your money. Get the latest investing insights delivered right to your inbox three times a week, with the Globe Investor newsletter. Sign up today.