For most of last year, Macy's (M 0.16%) was riding high. Through the first three quarters of fiscal 2018, comparable-store sales increased 2.7% year over year, driving margin expansion and strong growth in earnings per share.

Unfortunately, sales trends slowed dramatically beginning in December. Furthermore, while Macy's has continued to post positive comps -- barely -- its profit margin has plummeted this year, mainly due to bigger markdowns. As a result, shares of the top department store operator have fallen to around $15, after trading for more than $40 as recently as last August.

M Chart

Macy's Stock Performance, data by YCharts.

However, investors have overreacted to Macy's subpar results over the past few quarters. There's a good chance that the company will be able to return to EPS growth within a couple of years, sending Macy's stock soaring back to its 2018 highs, if not even higher.

Not all headwinds are secular in nature

Nobody would dispute that Macy's recent results have been unacceptable. First, the company is still losing market share. Second, excluding asset sale gains, adjusted EPS plunged 40% in the first half of fiscal 2019, from $1.02 to $0.61. Third, management hasn't been able to pinpoint when the recent negative trends will turn around.

That said, bearish analysts and other skeptics have been too quick to pin all of Macy's woes on long-term secular headwinds like the growth of e-commerce and the proliferation of discount apparel chains. Those headwinds are real, but they also existed last year and didn't prevent Macy's from posting solid results for nearly all of 2018.

The exterior of the Macy's flagship store in Manhattan

Macy's faces a combination of short-term and long-term challenges. Image source: Macy's.

For example, Macy's gross margin declined significantly in the first half of fiscal 2019 because the company had too much inventory in certain categories. Some of that relates to execution mistakes by the merchandise planning team that have already been corrected. Moreover, it's not surprising that Macy's bought too much inventory for the first half of this year, given that sales growth was much stronger a year ago, when it would have ordered the merchandise.

Additionally, sales to international tourists fell 9% year over year last quarter, as the strong dollar and slower economic growth outside the U.S. cut into tourists' buying power. That had a disproportionate impact on the profitability of some of Macy's best stores. The good news is that international tourist spending tends to be cyclical and should eventually bounce back.

Finally, the rapidly escalating trade war with China has hurt Macy's this year. However, in the long run, either the tariffs will be removed or Macy's and its suppliers will shift production to other countries. Either way, the profit headwind from rising tariffs will eventually disappear.

Investors may be underestimating cost-cutting opportunities

The investors who have been dumping Macy's stock this year have also been overlooking the company's potential to offset future profit headwinds with cost cuts.

A rendering of the exterior of a Macy's store

Macy's will publicly reveal a major cost-cutting program soon. Image source: Macy's.

Last year, the department store giant spent a little more than $9 billion on selling, general, and administrative (SG&A) expenses, or 36.2% of its net sales. By contrast, most discounters spend less than a quarter of their revenue on SG&A -- and in many cases that figure is less than 20%. While Macy's is always going to have a higher cost structure than these rivals, it clearly has plenty of room to cut costs.

Indeed, CFO Paula Price told investors in early 2019 that the company was preparing a major multiyear cost-cutting program. Macy's hasn't shared details of that effort yet, but will do so -- including hard numbers for its expected savings -- in early September.

Macy's stock swoon seems to be predicated on the idea that with U.S. economic growth slowing, the company's profitability is bound to deteriorate further. However, aside from the discrete headwinds that could reverse in the years ahead (i.e., tariffs, the inventory glut, and a downturn in international tourist spending), deep cost cuts could enable Macy's to expand its profit margin in a slow-growth environment.

Share buybacks could resume

One final catalyst that could lift Macy's stock in the years ahead is the potential resumption of the company's share-repurchase program. Not too long ago, Macy's was buying back stock at a frenetic pace. However, it suspended all share buybacks in early 2017 in order to focus on reducing its debt load.

Since then, Macy's has reduced its adjusted debt from $10.6 billion to $8 billion. So far, Macy's has continued to prioritize debt reduction, because its profitability has been under pressure. It is likely to pay down another big chunk of its debt near the end of this year.

Depending on whether its profitability rebounds quickly, Macy's should reach its debt reduction target by 2020 or 2021. That would allow it to start spending $500 million a year or more on buybacks. Considering how cheap Macy's stock is right now, this could give the shares a big boost.

Macy's shares currently trade for about five times earnings. If the company can get earnings growing again -- and demonstrate that it's not a fluke -- its earnings multiple is likely to expand dramatically. That could send the stock rocketing past $40 again within a few years.