What happened

Airline shares were flying higher again on Wednesday, the sector's second straight day of posting double-digit gains on improving optimism that the U.S. economy is in the early stages of a recovery. The shares gave back some of the advances as the morning continued, but much of the sector is still outperforming the broader markets as of midday.

Shares of Spirit Airlines (NYSE:SAVE) led the way at the open, jumping 18%, while shares of American Airlines Group (NASDAQ:AAL), United Airlines Holdings (NASDAQ:UAL), JetBlue Airways (NASDAQ:JBLU), Alaska Air Group (NYSE:ALK), Hawaiian Holdings (NASDAQ:HA), and Allegiant Travel (NASDAQ:ALGT) were all up double digits.

Delta Air Lines (NYSE:DAL) and Southwest Airlines (NYSE:LUV) are the relative laggards so far on Wednesday, each up "only" 8% at its peak.

So what

The airline sector has been hard-hit by the COVID-19 pandemic, with global travel demand reduced to near zero. The carriers are flying only 5% to 10% of their planned schedules in May, and with revenue bottoming out, the airlines have been scrambling to cut costs and raise liquidity.

Planes parked at the airport.

Image source: Getty Images.

The industry, thanks in part to $50 billion in government assistance as part of the CARES Act stimulus legislation, has the wherewithal to manage through the near-term crisis. But no amount of cutting will be enough if traffic and revenue do not return in the months to come.

The airlines have rallied in recent days on hints that the economy is beginning to normalize. The U.S. Memorial Day weekend brought pictures of tourists returning to vacation hot spots, and the number of passengers being screened by airport security, while still down nearly 90% year over year, is slowly improving over April lows.

The stocks gave back some of those gains as the broader market reversed course, a sign of how delicate the recovery is.

Now what

Airline stocks all lost more than half of their value as the crisis intensified, and even one of the most well-respected investors bailed on the sector during the sell-off.

The airlines were priced as if bankruptcies were inevitable. With each new glimmer of hope that a recovery might be at hand, the odds of bankruptcies diminish somewhat.

Investors need to remain cautious here. The pandemic is far from resolved, and health experts continue to warn of the possibility of a second wave of infections that could cause economic activity to slow again. Even in the best-case scenario it is likely to take years for traffic to return to prepandemic levels, and the airlines will likely limp along in the quarters to come even if demand does return somewhat.

Investors interested into buying into the rally should tread carefully, and stick to top names with the best chance of surviving even if conditions do turn south again.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.