Gap (GPS -3.83%) was nearly ruined by COVID-19 after all of its stores were shut down, but in the six months since the coronavirus outbreak was declared a pandemic, the owner of Old Navy, Banana Republic, and its own namesake stores has been one of the best-performing apparel retailers on the market.

Its second-quarter earnings report surprised many for its broad strength across brands, and analyst sentiment seems to be changing toward Gap. Although the retail industry remains in flux, let's take a look at whether this casual clothing company's stock is a buy today.

An Athleta storefront in a mall

Image source: Gap.

Best foot forward

It's difficult for investors to look at any company's performance since March and determine the direction it will take, but Gap has provided clues that offer hope for it being able to survive the retail wreckage, and even thrive going forward.

At the top of the list is Gap's smallest business, Athleta. In its second quarter the women's athleisure brand recorded a 6% increase in sales on a 19% surge in comparable-store sales. Online it looked even better, as digital sales rocketed 74% higher.

Athleta has been growing its reputation as an up-and-coming brand, and it is approaching Banana Republic's size in global sales. Look for it to become Gap's third-biggest brand in the very near future.

All of Gap's other brands saw sales decline sharply year over year, but that's not surprising since they have a much larger footprint than Athleta and their stores were closed for most of the quarter, which ended Aug. 1.

Moving online

It's the response Athleta enjoyed in digital sales, however, that underscores the retailer's full future potential. Across the board, Gap saw digital sales soaring, and while that was borne of necessity, it could point to how it continues to gain in the coming years.

Consolidated online net sales nearly doubled from the year-ago period, with Old Navy digital sales jumping 136%, Gap rising 75%, and even the ailing Banana Republic brand being up 26%. The latter, though, was hurt by its focus on business wear, but it was struggling even before the pandemic.

The real takeaway number for Gap, however, is the 3.5 million new online customers it added to its base, because it shows residual demand exists for its fashions. For too long, Gap has failed to capture the imagination of the consumer, but its second-quarter results indicate shoppers do still want to shop there if it has the right styles.

E-commerce is going to continue growing in importance, with the U.S. Census Bureau saying online sales surged almost 45% in the second quarter compared with last year (and were up 32% from the first quarter), even as total retail sales fell 3.6%. That means online sales account for over 16% of all retail sales, up from nearly 11% last year.

Challenges remain

Gap still has deep issues it needs to confront. Banana Republic hasn't posted a single quarter of higher comps in well over a year, and the boost it got this past quarter was primarily pandemic driven. 

Investors need to see if the retailer can keep up this momentum after the shock to the industry passes, and it still needs to deal with the threat poses as it comes to rely more heavily on digital sales.

Amazon is the largest online apparel retailer and has expanded its assortment to the luxury beat as well as the more affordable down-market side. It's also looking to build out 1,000 mini fulfillment centers in a move that could thwart Walmart's competitive advantage of using its physical supercenters to be closer to the consumer.

Worth the risk?

These issues will prove challenging to Gap, but the immediate future for the onetime iconic casual clothing company is looking brighter. That makes its depressed stock a buy, though I wouldn't back up the truck.

It's trying to reach new customers, as its deals with Kanye West and PopSugar show, and there's a certain last man standing benefit to be derived from other retailers being driven into bankruptcy. But Gap needs to prove its momentum is driven more by sustainable demand than just a one-off event of pent-up consumer splurges.