Stocks rallied Friday to cap a shaky week dogged by worries that rising U.S. coronavirus counts may halt the economy’s recent upswing.

The S&P 500 climbed 1%, and the biggest gains came from cruise ship operators, airlines, banks and other companies that most need the economy to continue to reopen and strengthen.

The TSX wasn’t far behind, with a 0.93% gain, with sentiment on the domestic front getting a further boost from a better-than-expected jobs report, as a record-setting 953,000 people regained employment in June. Combined with May’s gain of nearly 290,000 workers, the Canadian labour market has recovered about 40% of the three million jobs lost during the pandemic, according to Statistics Canada.

Story continues below advertisement

The Dow Jones Industrial Average rose 369.21 points, or 1.4%, to 26,075.30. The Nasdaq composite added 69.69, or 0.7%, to 10,617.44, a new high. The S&P 500 rose 32.99 to 3,185.04.

The S&P/TSX Composite Index closed up 145.18 points, or 0.93%, at 15,713.82, bolstered by the energy sector (up 3.29%) and financials (rising 1.93%). Money flowed into the cannabis sector as well, with Canopy Growth gaining 8.14%. Lumber stocks were also significant gainers, as investors gravitated to economically sensitive names while showing less interest in the technology shares; West Fraser Timber rose 7.81% and Norbord 6.33%.

After starting Friday with modest drops, U.S. stocks and Treasury yields erased their declines to drive higher. In a signal of rising expectations for the economy, the Russell 2000 index of smaller stocks rose more than the rest of the market, up 1.7%.

They’re the latest eddies in what was an erratic week for markets. Prices swung, sometimes sharply within a single day, with worries about rising hospitalizations and COVID-19 trends in Florida and other hotpots around the world. The S&P 500 flip-flopped between a gain and loss through each day of the week.

Story continues below advertisement

Analysts said an encouraging report from Gilead Sciences about its investigational treatment of COVID-19, remdesivir, helped drive Friday’s rebound.

“So, for the first time in a lot of days we’re seeing smaller caps outperform,” said Bob Shea, CEO of TrimTabs Asset Management. “We’re seeing just a kind of mean-reversion day, and they’re using the Gilead news to do it.”

The week’s meandering action was a microcosm of the up-and-down churn that stocks have been stuck in for a little more than a month. The market’s momentum has stalled since early June, after the S&P 500 roared back to recover most of an earlier 34% plummet. Massive amounts of aid from central banks and governments around the world ignited the rally.

“We are dealing with an unprecedented time economically,” said Katerina Simonetti, senior portfolio manager at UBS Private Wealth Management. “We have to remember that the government support and economic stimulus has been historically unprecedented. That’s a huge deal, and it’s going to make a difference for this market.”

Story continues below advertisement

It also helped send the S&P 500 to a 1.8% rise for the week, its second straight weekly gain.

“The market is in a kind of place where good news is a rally and bad news `the Fed’s got us,”' said Shea of TrimTabs Asset Management. “That’s the win-win the market has had for the last several weeks.”

Stocks of companies that most need the economy to continue improving and reopening dominated the top of Friday’s leaderboard.

Cruise operator Carnival jumped 10.8%, Royal Caribbean Cruises gained 9.9% and United Airlines rose 8.3%.

Story continues below advertisement

Banks were also particularly strong, and financial stocks in the S&P 500 climbed 3.5% for the biggest gain among the 11 sectors in the index. A stronger economy would mean their borrowers are better able to repay their loans.

JPMorgan Chase and Bank of America both rose 5.5%, while Citigroup jumped 6.5%.

Energy stocks rose with the price of oil, which has swung sharply with hopes for the economy. Benchmark U.S. crude oil rose 93 cents to settle at $40.55 per barrel. Brent crude added 89 cents to $43.24 per barrel.

Lagging behind the rest of the market were some of the stocks that have been holding up best this year: big tech-oriented giants. Microsoft dipped 0.3%, and Apple edged up 0.2%. It’s at least a pause for such stocks, which have climbed through the pandemic this year as investors bet they’ll keep growing almost regardless of the economy’s strength.

The yield on the 10-year Treasury, which tends to move with investors’ expectations for the economy and inflation, rose to 0.64% from 0.60% late Thursday.

Story continues below advertisement

In overseas stock markets, European markets climbed after reports showed industrial production bounced back sharply in some countries.

The CAC 40 in France added 1%, while Germany’s DAX returned 1.2%. The FTSE 100 in London gained 0.8%.

Asian markets were more subdued. The Nikkei 225 in Tokyo shed 1.1%, the Hang Seng in Hong Kong retreated 1.8% to 25,727.41 and the Kospi in Seoul lost 0.8%.

Even Chinese stocks took a break from their torrid run. Stocks in Shanghai slumped nearly 2% for their first drop in nearly two weeks. They’re still up 14.2% over that span.

Read more: Stocks that saw action Friday - and why

Story continues below advertisement

Globe staff, The Associated Press

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.