NEW YORK -- Stocks shot to a 3.4 per cent gain on Wall Street Wednesday as investors chose to focus on the optimistic side of data about the coronavirus outbreak's trajectory.

It's the latest about-face in this brutally volatile stretch for the U.S. stock market, which has flip-flopped from gains to losses for six straight days. Just a day before, stocks had been headed for a similar gain only for it to vanish in the last minutes of trading.

The market's upward swings have recently been bigger than the down moves, though, amid signs that deaths and infections may be nearing a peak or plateau in some of the world's hardest-hit areas. That's led some investors to envision the other side of the economic shutdown that is gripping the world as authorities try to slow the spread of the virus. The S&P 500 has jumped nearly 23% in the last two and a half weeks, building on earlier gains driven by massive amounts of aid promised by governments and central banks for the economy and markets.

Many analysts say they're skeptical of the rally given how much uncertainty still remains. The death toll continues to rise, millions of people are still losing their jobs by the week and the economic pain is worldwide. France's central bank said its economy entered a recession with a 6% drop in the first three months of the year.

But optimism rose in the market Wednesday after Dr. Anthony Fauci, the top U.S. infectious diseases expert, said the White House is working on plans to eventually reopen the country. President Donald Trump later said it "will be sooner rather than later."

"It's positive that people are talking about reopening the economy," said Jeff Buchbinder, equity strategist for LPL Financial. "The White House has been talking about that. The more we can focus on what the economy will look like several months out, the better it will be for markets."

The S&P 500 climbed 90.57 points, or 3.4%, to 2,749.98. For some investors, its rally of more than 20% since March 23 means a new "bull market" has been born. Others, though, want to see the gains hold for six months before confirming a new bull market.

The Dow Jones Industrial Average rose 779.71 points, or 3.4%, to 23,433.57 and the Nasdaq was up 203.64, or 2.6%, to 8,090.90.

Stocks that have been beaten down the most since the sell-off began in February helped lead the way, including energy companies, retailers and travel-related companies.

Gap rose 12.6%, United Airlines gained 12.4% and Diamondback Energy was up 13.5% as investors envisioned people shopping again at stores, flying for vacations and driving to the office once stay-at-home orders are relaxed. All three, though, are still down more than 50% for 2020 so far.

Shares of health insurers and other stocks got an extra boost after Bernie Sanders suspended his presidential campaign. Investors had been wary of Sanders' proposal of "Medicare For All" and other plans that could have restricted profits.

UnitedHealth rose 8% after being down in the morning, and Anthem jumped 10.3%.

Another bounce came in the afternoon after the Federal Reserve released minutes from its meeting last month, where it slashed short-term interest rates back to nearly zero. The minutes confirmed expectations that the Fed will do "whatever it takes" to support markets, according to Bob Miller, head of Americas fundamental fixed income at BlackRock.

Uncertainty, though, is still the dominant force in markets. The World Trade Organization said global trade could fall anywhere from 13% to 32% this year. The wide range was due to how unpredictable the pandemic is.

Companies are also preparing to report their financial results for the first three months of the year in upcoming weeks. The numbers are likely to be bleak, but investors don't know how long that will last. McDonald's on Wednesday pulled its forecast for restaurant growth and other measures for 2020 and the long term, citing the uncertainty created by the pandemic.

In Europe, stocks dipped after finance ministers clashed over a proposal to collectively combat the health crisis. Asian markets ended mixed.

Benchmark U.S. crude oil rose $1.46, or 6.2%, to settle at $25.09 a barrel, recovering some of its 9.4% slide from the prior day. Oil prices have been even more volatile than stocks recently as Russia and Saudi Arabia argue about production levels in the face of withering demand. Oil producers are set to meet on Thursday, and an announcement for production cuts to prop up the price of crude is possible.

Brent crude oil, the international standard, rose 97 cents, or 3%, to $32.84 a barrel.

The prospect for progress in oil talks was one of the bigger drivers of Wednesday's rally, along with the signs of virus infections levelling off in several global hotspots and increased clarity in the U.S. presidential race, said Adam Taback, chief investment officer for Wells Fargo Private Bank.

Treasury yields, which signalled worries about the economic damage coming from the coronavirus outbreak earlier than the stock market, were relatively steady. The yield on the 10-year Treasury rose to 0.76% from 0.73% late Tuesday.

More than 1.4 million cases of COVID-19 have been confirmed around the world, with more than 419,000 of them in the United States. More than 87,000 people have died from the virus, while over 317,000 have recovered, according to a tally by Johns Hopkins University.

------

AP Business Writer Yuri Kageyama contributed.