The news is terrible, but Wall Street had its best month in decades.

Stocks fell on Thursday, giving up some of their gains from the day before, after reports that showed millions more Americans applied for weekly unemployment benefits and consumer spending collapsed.

The S&P 500 closed down nearly 1 percent, but it was a small retreat in an otherwise strong month for Wall Street. Even with the decline on Thursday factored in, the S&P 500 had its best month since January 1987, a gain that came even as it became increasingly clear that the coronavirus crisis was pushing the United States into a dire economic downturn.

The nearly 13 percent gain this month means the S&P 500 is now up roughly 30 percent from its March 23 low. It’s a rally that has surprised even the most ardent bulls.

“Frankly, I’m shocked by the speed of the rally,” said Julian Emanuel, chief equity and derivatives strategist at the brokerage firm BTIG, who has been expecting a rebound since before the rally began.