New York CNN Business  — 

The pandemic has slammed Macy’s and other department stores. But signs of a recovery are beginning to emerge.

Macy’s said Tuesday that it turned a profit for the first time in the pandemic, making $160 million during the 13 weeks ending on January 30, down from $340 million during the same stretch a year ago.

To be sure, Macy’s is still struggling. Sales at stores open for at least one year dropped 17.1% during the period. Net sales dropped to $6.8 billion from $8.3 billion during the same quarter last year.

But Macy’s (M) beat out Wall Street’s projections. Its stock rallied during pre-market trading, but dropped 2% during early Tuesday trading. Heading into Tuesday, Macy’s (M) stock had dropped 5% over the past year.

Neil Saunders, managing director at GlobalData Retail, said in a note to clients that the results were a “marked improvement” and show that Macy’s is “slowly climbing its way out of the depths.”

The pandemic has created a stark divide in retail. It has hurt department stores and mall-based retailers that were forced to close when the virus surged last spring and these stores have not yet bounced back. Department stores JCPenney, Neiman Marcus, Barney’s, Century 21 and Lord & Taylor have all filed for bankruptcy during the pandemic. On Monday, an activist group of investors announced it had taken a stake in Kohl’s (KSS) and is pushing for an overhaul at the chain.

Meanwhile, the pandemic has lifted big box chains such as Walmart (WMT), Target (TGT) and Costco (COST) that have stayed open throughout the pandemic, as well as Amazon (AMZN). Walmart (WMT) said last week that sales at stores open for at least one year increased 8.6% in the quarter ending on Jan. 29.

Macy’s believes this coming year will be better than the last one.

It expects “continued pandemic-related challenges in the spring season,” but with “momentum building” in the second half of the year.

The company, in particular, is betting on strong growth online in the coming years.

“We anticipate annual digital sales to reach $10 billion within the next three years, and that digital will become an even more profitable contributor to our business,” CEO Jeff Gennette said.