By Caitlin Ostroff, Paul Vigna and Joanne Chiu

U.S. stocks rose Tuesday on optimism about economies reopening and the potential development of a coronavirus vaccine.

The Dow Jones Industrial Average rose 667 points, or 2.7%, to 25132. The S&P 500 rose 1.9%, climbing back above 3000 for the first time since early March and above its 200-day moving average, a closely watched barometer of its strength. The technology-heavy Nasdaq Composite rose 1%.

Investors were cheering signs of economic activity resuming faster than expected across parts of the U.S. and elsewhere in the world. Restaurant bookings and spending on hotels and airlines appears to be picking up in the U.S., coinciding with a decline in the daily number of new infections.

The U.K. has laid out plans to reopen retail stores next month, while Italy, one of the hardest-hit countries, saw people return to bars and restaurants over the weekend.

Stocks have quickly recaptured a level of euphoria usually seen at market tops, said Peter Boockvar, chief investment officer at Bleakley Advisory Group. That's because stock traders are looking only at the direction of the recovery, while bonds are more concerned with the degree of the recovery, he said.

"As long as things are reopening, the economic data don't matter," Mr. Boockvar added.

Investors are also betting that one of at least 10 coronavirus vaccines under development will eventually come to market, halting the spread of the coronavirus and allowing normal business and social activity to resume.

Novavax said Monday that it started the first human study of its experimental vaccine. Drugmakers including Pfizer and Moderna are also racing to develop a vaccine. Novavax shares rose 13%, while Moderna fell 10%. Pfizer was up 0.8%.

"It looks like we have several shots on goal," said Hani Redha, a multiasset portfolio manager at PineBridge Investments. Although manufacturing a vaccine and disseminating it to the wider population will take time, the number of potential candidates has buoyed markets.

"Any kind of glimmer of hope about any trial going well or any trial starting is going to be good," he said.

The concern among some investors is how to value stocks when earnings have fallen so sharply and many companies have withdrawn their future forecasts.

The recent rally has pushed the S&P 500's forward-looking price-to-earnings ratio to 23.36, its highest level since 2002. But corporate profits are expected to remain under pressure until next year as sales tumble and expenses rise as companies spend to make their workplaces safe.

"It's safe to say it's going to be a couple of years," before earnings recover, Mr. Boockvar said.

After S&P 500 operating earnings hit $157 a share in 2019, they are projected to fall to $111 this year and rise to $162 in 2021, according to estimates from Howard Silverblatt, the senior index analyst at S&P Dow Jones Indices.

"If we see the upward turn in earnings, then the current levels may be justified," Mr. Silverblatt said. "If not, the Street will need to reprice."

In another sign investors are embracing risk, a range of assets typically considered safe are falling sharply. Most actively traded gold futures are down 1.5% at $1,708.90 a troy ounce, while the WSJ Dollar Index is down 0.8% as investors favor riskier parts of the market like commodities and emerging markets.

It is unusual for gold and the dollar to be down so much at the same time because a weaker dollar makes gold and other dollar-denominated assets cheaper for overseas buyers. The synchronous drop highlights the strength of Tuesday's "risk-on" move.

The trend is also sending Treasury yields higher as investors retreat from ultrasafe Treasurys. The yield on 10-year Treasurys ticked up to 0.698%, from 0.659% Friday. Bond yields in northern European countries rose while yields fell in southern nations, including Italy and Greece. Yields and prices move inversely.

West Texas Intermediate, the main U.S. crude gauge, advanced 1.2% to $33.66 a barrel.

Overseas, the pan-continental Stoxx Europe 600 advanced 0.9%, led by gains in bank shares and the travel and leisure sector. Most major Asia-Pacific equity benchmarks ended the day higher. In Japan, where the government lifted its state of emergency Monday, the Nikkei 225 rose 2.6%.

Australia's benchmark index rose 2.9%, while Hong Kong's Hang Seng Index advanced 1.9%. The Shanghai Composite gained 1%.

On the data front, the Conference Board's May consumer confidence index rose to 86.6 from 85.7 in April, above expectations. New homes sales were also stronger than expected, rising to 623,000 in April from 619,000 in March.

Write to Caitlin Ostroff at caitlin.ostroff@wsj.com, Paul Vigna at paul.vigna@wsj.com and Joanne Chiu at joanne.chiu@wsj.com