Hardly anybody had high hopes for Macy's (M 0.10%) ahead of the struggling department store giant's first-quarter earnings report. Still, on Thursday morning, the company announced sales and earnings results that fell short of the market's low expectations.

Investors took the news badly, sending Macy's stock down as much as 14%. However, Mr. Market may be overreacting. While sales and earnings both plunged, Macy's cash flow performance actually improved last quarter.

Another earnings wipeout

The big highlight of Macy's first quarter was that the company closed more than 60 full-line stores as part of a broad downsizing effort. Macy's also laid off thousands of employees as it restructures to cope with lower mall traffic.

The store closures contributed to a 7.5% plunge in net sales at Macy's last quarter. (This came on top of a similar 7.4% decline in the first quarter of 2016.) Comparable-store sales also declined 4.6%, including licensed departments. Macy's revenue of $5.34 billion came in well short of the average analyst estimate of $5.47 billion.

The exterior of Macy's Manhattan flagship store

Macy's sales and earnings results missed expectations last quarter. Image source: Macy's.

The weak first-quarter sales performance was accompanied by a 1 percentage point decline in gross margin (from 39.1% to 38.1%). As a result, profit plunged despite Macy's deep cost cuts. Adjusted EPS fell to just $0.24, down from $0.40 a year earlier.

But cash flow rises

While Macy's earnings cratered last quarter, its cash flow improved significantly. Operating cash flow totaled $234 million, up from just $8 million in the first quarter of 2016. (That said, much of this discrepancy was driven by a change in the timing of Macy's tax payments.)

Meanwhile, capital spending (including for software) declined by $51 million year over year. Finally, Macy's received $96 million in proceeds from asset sales during the quarter. Most of that cash came from the previously announced sale of its downtown Minneapolis flagship store.

As a result, Macy's was able to pay $115 million in dividends and spend $149 million to repurchase debt while still ending the quarter with $1.2 billion of cash. This quarter, it will pay off at least $300 million of additional debt that matures in July.

The real estate maneuvers continue

Macy's will continue to sell off excess real estate as 2017 progresses, bringing in incremental cash. First, it is still in the process of selling some of the stores that it has closed this year.

Second, Macy's announced in its earnings release that it is under contract to sell another two floors of its downtown Seattle store. In 2015, it sold the top four floors of that building for $65 million, so a reasonable guess is that this deal will bring in $30 million to $35 million. After the sale, Macy's will continue to operate a sizable store on the lower three floors.

Macy's has other big real estate maneuvers in the works, including selling the upper floors of its Chicago flagship store, redeveloping dozens of mall-based locations, and monetizing some of the value from its Manhattan flagship store. However, these initiatives will probably start to bear fruit in 2018.

Investors may be overreacting

Despite its weak Q1 sales and earnings performance, Macy's is maintaining its full-year sales and earnings guidance. It expects comp sales to decline 2%-3% and adjusted EPS to reach $2.90-$3.15 (excluding the gain from selling its men's store in San Francisco), compared to adjusted EPS of $3.11 in 2016.

Of course, the fact that Macy's is maintaining its guidance doesn't guarantee that it will achieve it. However, management had expected the first quarter to be the worst part of the year for several reasons. First, Macy's entered the quarter with too much inventory, pressuring margins. Second, Macy's didn't get the benefit of its 2017 store closures until the very end of Q1. Third, Macy's is just starting to roll out its latest round of sales growth initiatives.

Sales trends did improve as the quarter progressed, which is an encouraging sign. The solid cash flow performance also suggests that the popular narrative about Macy's downfall is off base.

As a long-term Macy's shareholder, I will happily collect the company's generous dividend -- which now has a 6% yield -- knowing that Macy's generates plenty of cash to back it up. Looking ahead, as the company's sales-driving initiatives kick in and its real estate deals free up more cash, Macy's stock could bounce back in a big way.