After posting dreadful sales and earnings results in the first quarter, Macy's (M 1.19%) got back on a better trajectory last quarter. Sales and earnings per share both came in slightly ahead of analysts' estimates.

Nevertheless, shares of Macy's plunged following its earnings report last week, falling to a new multiyear low. Investors appear to be wholly focused on the fact that sales and earnings are still declining, rather than on the evidence that Macy's is starting to stabilize its business. Macy's stock has now lost more than half of its value since December.

M Chart

Macy's Stock Performance, data by YCharts.

During 2017, Macy's stock has borne the brunt of investors' worries about the future of the department store business. Yet the company's long-term prospects are far better than its rock-bottom stock price would seem to suggest.

Sales and earnings declines slow

In the first quarter, comparable store sales plunged 4.6% year over year at Macy's (including licensed departments). Operating income totaled $220 million, including $68 million of real estate gains. By contrast, Macy's generated $276 million of operating income a year earlier, with just $14 million of asset sale gains.

Comp sales fell by a more modest 2.5% last quarter. This was slightly better than what analysts had expected. It also exceeded the company's internal forecast. Adjusted operating income declined to $305 million (including $43 million of real estate gains), down from $372 million (including $21 million of real estate gains) a year earlier.

The Macy's corporate logo

Macy's sales trend improved during the second quarter. Image source: Macy's.

Macy's earnings power is definitely still receding. That said, the company remains solidly profitable. Furthermore, department store operators like Macy's typically produce a large portion of their annual earnings in the fourth quarter.

The balance sheet is getting healthier

Macy's is also continuing to repair its balance sheet after taking on too much debt a couple of years ago. In early 2016, Macy's had more than $7.6 billion of debt, compared to $1.1 billion of cash.

Since then, through a combination of scheduled principal repayments and debt repurchases, Macy's has whittled down its debt burden to $6.3 billion. Furthermore, it still has $783 million of cash and cash equivalents.

Even now, Macy's has somewhat more debt than management would like. However, the company has shown that it can pay down debt fairly quickly when it wants to. Macy's is likely to continue its debt reduction efforts during the fourth quarter, when it will generate the bulk of its free cash flow for the year.

Real estate monetization is moving forward

Macy's is making progress on its real estate monetization strategy, too. It has already booked more than $100 million of gains from selling excess real estate this year. For the full year, Macy's now expects to realize $275 million-$300 million of asset sale gains, excluding the sale of its San Francisco Union Square men's store. (Macy's received the cash for that deal last year, but for accounting reasons, the gain will be booked at the end of fiscal 2017.)

Meanwhile, Brookfield Asset Management (BN 1.59%) is creating preliminary development plans for 50 Macy's properties. These could involve adding restaurants, a hotel, or residential space on excess land owned by Macy's. In some cases, it could entail closing a store to pave the way for a redevelopment project.

Based on this preliminary work, Brookfield Asset Management is likely to recommend moving forward on development projects for about two-thirds of the 50 properties, according to Macy's CFO Karen Hoguet. However, Brookfield is still less than a year into the two-year exclusivity period of its alliance with Macy's, so firm development plans may not emerge until 2018.

As for its flagship assets, Macy's is actively marketing the upper floors of its massive Chicago store. It is still studying options for redeveloping portions of its extremely valuable Manhattan flagship store.

The exterior of the Macy's Herald Square flagship store

Macy's hasn't decided how to monetize its Manhattan flagship store yet. Image source: Macy's.

The outlook hasn't changed

Despite the challenging retail environment, Macy's hasn't changed its 2017 EPS guidance. The company still expects to produce adjusted EPS of $2.90-$3.15, excluding the Union Square asset sale gain. This would be roughly flat or down modestly from last year's adjusted EPS of $3.11.

To be fair, asset sale gains -- which are not a sustainable source of earnings -- will likely account for about 20% of Macy's profit this year (roughly $0.60 of EPS). That said, the $275 million-$300 million of expected asset sale gains for 2017 would not be much different from the $209 million in gains realized last year.

Furthermore, even after deducting expected asset sale gains, Macy's stock trades for less than nine times the company's 2017 earnings forecast. It has a 7.3% dividend yield as well. Investors appear to be completely discounting the possibility that Macy's will be able to stabilize its business in the next year or two while ignoring the company's massive trove of real estate.

Considering how bad Macy's Q1 earnings report was, investors should have been relieved about its second quarter results. Instead, panic remains the order of the day. As a Macy's shareholder myself, I remain confident in the company's long-term prospects. I plan to stay patient and reinvest most of my dividends into the stock to take advantage of its rock-bottom valuation.