Dillard’s surprised investors last week by reporting a record first-quarter profit. Macy’s (NYSE: M) couldn’t quite match that performance, but the department store behemoth did post extremely strong results despite the COVID-19 pandemic’s ongoing impact on store traffic. This quick turnaround should help Macy’s maintain its recent share price gains.

Last quarter, Macy’s sales increased 56 percent year on year to $4.71 billion. Of course, the company was confronted with a simple comparison. Its stores were closed for roughly half of the first quarter of fiscal 2020, and consumer spending on discretionary items plummeted during the pandemic’s early stages.

In comparison to the first quarter of 2019, sales fell 14.5 percent. However, sales trends improved throughout the quarter as more Americans became fully vaccinated and the US economy reopened. Comparing the first quarter of 2019 to the first quarter of 2018, digital sales increased by 32%, while brick-and-mortar comps fell by 24%.

Notably, Macy’s Q1 sales easily exceeded the $4.19 billion to $4.29 billion guidance range provided by management in late February. Analysts were slightly more optimistic, forecasting sales of $4.37 billion (on average), but in retrospect, they also underestimated Macy’s sales recovery.

Macy’s sales beat resulted in an even bigger earnings beat. Gross margin increased to 38.6 percent in the first quarter of 2020, up from 38.2 percent in the first quarter of 2019 and a meager 17.1 percent in Q1 2020. The retail icon saw a significant increase in its underlying merchandise margin, which was offset in part by higher delivery costs (largely driven by the big increase in digital sales).

Meanwhile, Macy’s reduced its operating expenses by 17.2 percent in the first quarter of 2019 compared to the first quarter of 2018. Furthermore, despite lower credit card penetration, fewer new account openings, and lower average balances, credit card revenue held up well at $159 million, a 7.6 percent decrease from Q1 2019.

When everything is taken into account, Macy’s adjusted earnings before interest, taxes, depreciation, and amortization increased to $473 million from $447 million two years ago. Earnings per share fell to $0.32 in the first quarter of 2019 from $0.44 in the previous quarter. EPS increased by $0.04 to $0.38 after excluding special items and asset sale gains. This result fell short of management’s initial Q1 guidance for a quarterly loss of $0.45 to $0.52 per share, as well as the analyst consensus of $0.41 per share.

Macy’s generated $395 million of free cash flow last quarter ($119 million after adjusting for a decrease in outstanding checks). This represented a strong result, considering that Q1 tends to be a seasonally weak period for cash flow.

As a result, Macy’s had $1.8 billion in cash at the end of the third quarter. This is more than enough to cover an upcoming $294 million debt maturity as well as any short-term working capital requirements. Indeed, given that Macy’s is expected to generate significant additional free cash flow over the next year, the company should be able to pay off $1.3 billion of high-cost debt issued last year when it becomes eligible for optional redemption next June. This will significantly reduce future interest costs.

Macy’s increased its full-year sales guidance by more than $1.7 billion at the midpoint, following a strong first-quarter performance. It also increased its adjusted EPS forecast to a new range of $1.71 to $2.12, which is significantly higher than its previous guidance range of $0.40 to $0.90. Macy’s expects sales of $4.9 billion to $5 billion in the second quarter, with earnings per share ranging from $0.03 to $0.12.

According to Macy’s updated forecast, sales will remain at least 10% lower than in the second quarter of 2019 and for fiscal 2021 as a whole. It also implies that adjusted earnings per share will fall below 2019 levels for the rest of the year. That could explain why, despite the massive earnings beat, Macy’s stock fell slightly on Tuesday.

However, this advice may be overly cautious. Management is preparing for future volatility in sales trends. However, with the economic reopening process expected to accelerate this quarter, demand for seasonal items, dressy clothing, luggage, and other merchandise categories that struggled last year is expected to improve even more.