Gap (GPS -0.71%) was hit hard by the COVID-19 pandemic in the first quarter of fiscal 2020. Sales plunged 43% year over year, gross margin cratered to just 12.7% due to a $235 million inventory writedown, the company posted a net loss of $932 million, and free cash flow was negative to the tune of more than $1 billion.

The apparel retail giant started to pick up the pieces in the second quarter. While Gap's Q2 results were still weak by historical standards, they reflected a meaningful sequential improvement compared to the first quarter.

The quarter at a glance

Gap's total sales declined 18% year over year in the second quarter. Online sales surged 95%, partially offsetting a 48% drop in store sales. Temporary store closures accounted for the majority of the decline in store sales last quarter. In fact, comparable sales -- a metric that excludes temporarily closed stores from the year-over-year comparison -- jumped 13%.

Not surprisingly, Gap's Athleta yoga and athleticwear brand posted the best performance within the company last quarter, with sales up 6%. Old Navy also turned in a solid performance, thanks to its focus on affordable casual clothing, with sales down just 5%. By contrast, the struggling Gap brand reported a 28% sales decline, while Banana Republic saw sales plunge 52% due to its heavy exposure to workwear.

At the beginning of the quarter, all of the company's stores were closed, whereas 90% were open by Aug. 1. Given that online demand remained strong throughout the quarter, it's safe to guess that total sales trends were significantly better in June and July than in May.

The exterior of the Old Navy San Francisco flagship store.

Image source: Gap Inc.

Gross margin came in at 35.1%: a huge improvement over the first quarter, but down by 3.8 percentage points year over year. The surge in online sales and an uptick in split shipments caused by inventory being out of place combined to drive shipping costs higher, accounting for most of the gross margin pressure. Operating income swung back to positive territory, coming in at $73 million. Factoring in interest expense, a tax adjustment, and a one-time debt extinguishment charge, Gap posted a loss of $0.17 per share under generally accepted accounting principles (GAAP). Analysts had expected a $0.41 loss per share, on average.

Gap also swung back to positive cash flow last quarter, generating over $750 million of free cash flow. On a year-to-date basis, though, free cash flow remains negative at -$295 million.

Management expects further improvement

While Gap isn't providing any financial guidance, management struck an optimistic tone on the earnings call, saying that sales trends would improve in the second half of the year compared to Q2. Additionally, the company is making strategic investments in marketing in an effort to gain share during the pandemic.

Gap executives did caution that shipping costs will remain a headwind, albeit a smaller headwind Q3. Additionally, the company faces temporarily elevated store costs related to coronavirus safety measures. However, Gap hopes to offset some of these cost pressures by permanently closing underperforming stores and reducing corporate overhead costs.

Given that the stronger Old Navy and Athleta brands accounted for 54% of the company's sales last year and 66% of its sales last quarter, Gap seems to be well positioned to slow its sales declines and return to positive earnings in the second half of fiscal 2020.

Plenty of challenges ahead

With mall traffic weaker than ever, Gap has again expanded its plans for store closures. The company now plans more than 225 net store closures for the Gap and Banana Republic brands in 2020, with additional stores closing next year. In the first half of fiscal 2020, it closed 116 Gap and Banana Republic stores, net of new openings.

Pivoting toward e-commerce and away from malls may bolster these brands' profitability in the short run. However, it won't address their fundamental weaknesses. Gap lost its cool factor years ago, and even a new partnership with Kanye West announced, in June isn't likely to change that. Meanwhile, the ongoing shift toward working from home and more casual attire in workplaces will continue to hurt Banana Republic.

By contrast, Old Navy and Athleta are good businesses with solid growth prospects. That said, Gap stock has already recovered all of its year-to-date losses, while the company's long-term margin prospects remain uncertain. Other retail turnaround plays may be better options for long-term investors right now.