By Akane Otani and Avantika Chilkoti

U.S. stocks ripped higher after expectations-defying data showed the country added 2.5 million jobs in May, boosting investors' bets on a nascent, if likely uneven economic recovery.

Investors have been betting that the country will be able to both contain the spread of the coronavirus and reopen businesses in the coming months. Many are pricing in a "V-shaped" recovery: a sharp upturn in spending and growth that follows a short, painful collapse in economic activity.

Friday's jobs report appeared to be the clearest indication yet that the economy may be able to pull out of its downturn faster than investors had expected.

The Labor Department said the U.S. added 2.5 million jobs in May--a stunning gain, given economists surveyed by The Wall Street Journal had expected a loss of 8.3 million jobs. The unemployment rate also unexpectedly fell, clocking in at 13%, compared with estimates of 20%.

"Something like this builds credibility for what the stock market has been telling you," said Brian Belski, chief investment strategist for BMO Capital Markets. "There's a massive amount of negativity among macro analysts. But the proof is in the pudding."

The Dow Jones Industrial Average climbed 964 points, or 3.7%, to 27246. The S&P 500 advanced 3% and the Nasdaq Composite climbed 2.3%, heading toward a fresh closing high.

Shares of cyclical companies, whose profits are closely tied to the economy's trajectory, helped lead Friday's stock rally.

Heavy machinery manufacturer Caterpillar jumped 4.9%, while aerospace giant Boeing rose 15%.

Bank stocks also posted big gains, with Bank of America up 6.2% and Goldman Sachs Group rising 2.7%. Bank stocks tend to pick up when investors expect economic conditions will improve, boosting lending activity.

In another mark of optimism, gold prices dropped 2.5% for their biggest one-day slide since March. Investors tend to buy the precious metal to hedge against anticipations of market turmoil.

Some investors urge caution, though.

Massive stimulus packages and the loosening of restrictions on business and travel across the world appear to have helped drive the stock market's recent surge. But many are fearful the gains may only be temporary.

Further government intervention might be needed to support businesses if activity doesn't rebound by the third quarter, said Daryl Liew, chief investment officer at REYL Singapore.

Stock gains were broad Friday, with all 11 sectors of the S&P 500 on track to end the day higher.

Elsewhere, the Stoxx Europe 600 benchmark rose 2.5%. On Thursday, the European Central Bank scaled up its bond-buying program and Germany adopted its second economic-stimulus package since the start of the coronavirus pandemic.

"It's a step in the right direction from the European leaders and shows some unity," said Brian O'Reilly, head of market strategy for Mediolanum International Funds. Rising bond yields help banks, which borrow short-term to lend long-term, boosting profitability.

In Asia, Hong Kong's Hang Seng benchmark rose 1.7% and South Korea's Kospi rallied 1.4%.

Joanne Chiu contributed to this article

Write to Akane Otani at akane.otani@wsj.com, Avantika Chilkoti at Avantika.Chilkoti@wsj.com and Joanne Chiu at joanne.chiu@wsj.com