Wall Street wrapped up one of its most remarkable 50-day runs on Wednesday, posting a 40 percent advance that telegraphs optimism against the three-pronged downward pull of disease, civil unrest and economic deterioration.

The Standard & Poor’s 500 closed at 3,122.87, a gain of 42 points or 1.4 percent. The broad market’s comeback from its March 23 low marks its best 50-day performance since 1933, according to Howard Silverblatt of S&P Dow Jones Indices.

The Dow Jones industrial average swelled more than 527 points, a 2 percent advance that places the blue chips at 26,269.89. The Nasdaq composite rose 74 points, or 0.8 percent, to finish at 9,682.91. The tech-heavy index is up 8 percent on the year and within 2 percent of its all-time high.

All three indexes are 40 percent above their pandemic lows after chalking up two straight months of gains, despite Depression-era unemployment numbers, a pandemic that has killed more than 105,000 Americans, and a week of upheaval in American cities following the death of another black man in police custody.

“Despite the turbulence and turmoil in our economy from the health crisis, the resulting economic downturn, and civil unrest, the market is anticipating we will get through these problems and the underlying strength of the economy will emerge intact,” said Ed Yardeni, president of Yardeni Research. “It’s a ray of sunshine. We should all be heartened. It’s better than seeing investors selling stocks, betting that we can’t solve our problems and we are headed into a depression.”

Policymakers in the United States, Europe and Japan have rushed trillions in stimulus into their economies in an effort to forestall a depression because of the steep drop in business and social activity due to the pandemic. Economies have begun to revive, and fear appears to be receding as the number of coronavirus deaths slow and hopes for a treatment rise.

Positive news is filtering through the economy. Personal incomes rose 10.5 percent, thanks largely to federal stimulus checks. First-time unemployment filings have leveled off. The housing market is on the rise, helped by record-low interest rates. Private payrolls shed 2.76 million jobs in May, ADP reported Wednesday, well below the 8.75 million that economists surveyed by Dow Jones had expected.

Energy, financials and industrials have led the S&P stock sectors for more than a week on investor belief that the economy is on the road to recovery and will cure everything from low oil prices to empty cruise ships and airplanes.

“Investors are embracing renewed signs of life in consumer spending as we see restaurants, airlines, hotels and real estate all appearing to turn a little bit of a corner,” said Nicole Tanenbaum, chief investment strategist at Chequers Financial Management.

But storm clouds remain due to the recent flare-up in U.S.-China tensions and widespread protests since George Floyd died May 25 in Minneapolis. And the economy is a long way from its pre-pandemic momentum, with 40 million unemployed, airline travel at a crawl and health officials cautioning that the virus could surge in the fall.

The U.S. unemployment rate stood at 14.7 percent in April — the worst since the Great Depression — and is expected to push toward 20 percent when the Labor Department releases May data on Friday.

Analysts signaled caution.

“Unrealistic expectations for a V-shaped economic and earnings recovery is driving stocks higher,” said Daniel Wiener, chairman of Adviser Investments.

Every index in Asia and Europe was positive, with most European markets pushing more than 2.5 percent higher. Continued declines in coronavirus cases in some of the hardest-hit countries, amid gradual steps toward normalcy, have raised confidence.

Manufacturing showed signs of stabilizing after four months of contraction, according to the Institute for Supply Management’s May report. Timothy Fiore, the ISM’s chair of the business survey committee, wrote that May was a “transition month” and a signal the country was getting back to work. Demand, however, “remains uncertain.”

Crude prices retreated after Saudi Arabia and Russia agreed to maintain production cuts through July. Energy consumption has been rising as shutdowns unwind, spurring more driving and air travel. U.S. oil futures fell 20 cents to $36.61 a barrel — a 0.5 percent drop. World benchmark Brent crude slid 0.7 percent to $39.27 a barrel. Oil prices have surged in the past month as production cuts chewed into a supply glut, but prices remain far below what most producers need to make a profit.