Macy's (NYSE:M) has made a remarkable comeback in 2021 after investors left the iconic retailer for dead last year. Sales have recovered and then rocketed beyond pre-pandemic levels. Meanwhile, profitability has improved dramatically, driving earnings to record levels.

On Thursday, the department-store giant reported that its strong momentum continued in the third quarter. It also confirmed that it's studying the possibility of spinning off its digital operations to capitalize on sky-high valuations for e-commerce businesses. As a result, Macy's stock jumped 21% after the earnings report, reaching a multiyear high.

M Chart

Macy's stock performance, data by YCharts.

Another stellar quarter

Three months ago, Macy's announced that sales had surpassed 2019 levels in the second quarter of fiscal 2021. Comparable sales increased 5.9%, compared to Q2 2019, while total sales inched up 1.8% to $5.65 billion.

Just as importantly, gross margin increased due to strong demand and tight inventories, while operating expenses fell, due to cost cuts and low staffing. As a result, adjusted earnings per share (EPS) more than quadrupled to $1.29 from $0.28 two years earlier.

Macy's momentum accelerated in the third quarter. Including licensed departments, comparable sales increased 8.7% relative to the third quarter of fiscal 2019. Total sales rose 5.2% over the same period, reaching $5.44 billion, solidly ahead of the analyst consensus of $5.2 billion.

Once again, Macy's managed to expand its profit margin dramatically, overcoming headwinds like soaring freight costs, rising wage rates, and supply-chain snarls. Gross margin increased by 1 percentage point, compared to Q3 2019, while operating expenses plunged more than 10%, despite higher sales.

This boosted adjusted EPS to $1.23 last quarter, quadruple the average analyst estimate of $0.31 and up from just $0.07 two years ago.

Macy's has fixed its balance sheet

Due to the uncertainty created by the pandemic, Macy's has carried a lot of cash for most of the past year. However, thanks to the company's strong momentum, management felt comfortable deploying that cash hoard during the third quarter.

In August, Macy's retired $1.3 billion of high-cost secured debt that it had issued in 2020. That will reduce its annual interest expense by more than $100 million going forward. In October, it repaid another $294 million that was set to mature in January 2022. With those moves, Macy's has met its deleveraging target set out more than five years ago, although it plans to continue reducing its debt load when additional borrowings come due in 2023.

The exterior of Macy's Manhattan flagship store.

Image source: Macy's.

Macy's also restarted its dividend last quarter, paying out $0.15 per share. Finally, the company completed more than half of the $500 million share-buyback authorization it announced in August, reducing its share count by 4%.

Looking ahead

Following the big earnings beat, Macy's raised its full-year outlook again. It expects sales of $24.2 billion at the midpoint of its new guidance range, which is more than $400 million ahead of its previous forecast. It also hiked its adjusted EPS guidance to a new range of $4.57 to $4.76, up by 30% at the midpoint, compared to its August forecast.

Investors had many reasons to cheer about Macy's strong earnings report and guidance increase. And even after skyrocketing 21% on Thursday, Macy's stock trades for just eight times the company's updated 2021 EPS guidance.

That said, Macy's is benefiting from an unusually favorable consumer environment right now. Management has acknowledged that the company's recent level of profitability is probably unsustainable.

Macy's announcement that it will launch a new digital-marketplace business next year and news that it has hired a consulting firm to study a potential spinoff of its e-commerce unit likely drove the bulk of the stock's gains. A pair of activist investment firms have argued recently that such a spinoff could unlock massive upside for Macy's stock.

Indeed, Macy's shares could continue rising, thanks to its soaring earnings and the market's enthusiasm for growing e-commerce businesses. Yet it's far too early to be confident that Macy's has returned to sustainable growth. Moreover, spinning off the e-commerce business would probably be a bad move in the long run. Thus, investors may want to think twice before chasing Macy's stock.

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.