Wall Street shakes off bad economic news as data on antiviral drug lifts hopes.

Stocks rallied on Wednesday, bolstered by indications that a drug being tested as a possible treatment for Covid-19 could be showing progress, and as investors pinned their hopes on the gradual reopening of the world’s major economies.

The S&P 500 gained nearly 3 percent, while shares in Europe were also sharply higher.

The rally came despite data that showed the U.S. economy shrank in the first quarter of the year by the most since 2008. Earnings reports from Volkswagen, Samsung, Airbus, Boeing and other giant businesses were also grim.

But investors have been shaking off bad news on the economy for weeks as they focus on progress on efforts to contain the coronavirus pandemic. A steady climb has lifted the S&P 500 by more than 31 percent since its March 23 low. With nearly half that gain coming in April, the month is on track to be the best for stocks since 1974, according to data from Howard Silverblatt, senior index analyst for S&P Dow Jones Indices.

The trading on Wednesday had all the hallmarks of a rally fueled by hopes of a return to normal, with shares of airlines and cruise operators — both industries that are dependent on the end of restrictions and the return of travelers — among the best-performing stocks in the S&P 500. Oil producers also rallied as the price of crude oil surged.