Throughout much of 2015 and early 2016, department stores struggled with a sharp slowdown in demand. A variety of factors were to blame, including the strong dollar (driving down sales to tourists) and unfavorable weather.

Yet most investors zeroed in on just one cause of department stores' woes: the rise of Amazon.com and e-commerce more broadly. The result was a widespread panic that has left most department store stocks in bargain-basement territory.

However, department stores aren't dead yet. That was made very clear on Thursday, when three of the biggest department store companies -- Macy's (M -2.68%), Kohl's (KSS 1.49%), and Nordstrom (JWN 0.96%) -- all reported big earnings beats.

Macy's blew by analysts' EPS estimates for Q2. Image source: The Motley Fool.

Macy's stops the bleeding

On Thursday morning, Macy's reported adjusted earnings per share of $0.54 for Q2. While that was down from $0.64 a year earlier, it was still 20% ahead of the average analyst estimate.

Comparable store sales continued to decline during the quarter, falling 2% year over year (including licensed departments). Still, this represented a huge improvement compared to the first quarter, when comp sales plunged 5.6% on that basis.

Macy's sales trend strengthened sequentially as the quarter progressed. That bodes well for the company's performance in the second half of the year. For now, Macy's is holding its guidance range steady at $3.15-$3.40. However, that now includes a lower estimate for asset sale gains to be recognized this year, due to a shift in the timing of a store redevelopment project in Brooklyn. Excluding that change, Macy's full-year EPS guidance would have increased by $0.10.

Finally, Macy's announced an aggressive store closure plan. It intends to close about 100 full-line Macy's stores, mainly in early 2017. This will free up capital for Macy's to reinvest in better-performing stores while also returning cash to shareholders and/or paying down debt.

Kohl's posts surprise profit growth

Also on Thursday morning, Kohl's reported a 1.8% decrease in comp sales for Q2. While the company had hoped for a better sales result, it still posted solid improvement relative to its 3.9% Q1 comp sales decline.

Moreover, better inventory management and tight cost control enabled Kohl's to improve its profit margin relative to the prior-year quarter. As a result, adjusted net income rose 5% year over year and adjusted EPS surged 14% to $1.22, blowing by the average analyst estimate of $1.03.

Surprisingly, Kohl's EPS rose 14% year over year last quarter. Image source: The Motley Fool.

Despite the strong earnings performance, Kohl's reduced its full-year adjusted EPS guidance range from $4.05-$4.25 to $3.80-$4.00 due to its ongoing revenue declines. That didn't faze investors, though, as hardly anyone had still expected Kohl's to achieve its original full-year guidance.

Nordstrom surges past estimates

Lastly, on Thursday afternoon, Nordstrom reported EPS of $0.67 for the second quarter. That was down substantially from its adjusted EPS of $0.93 a year earlier, but it still easily beat the average analyst estimate of $0.56.

Nordstrom's higher-than-expected profit was driven by improving sales trends in both its full-price and off-price segments. However, the biggest improvement came on the full-price side, where comparable store sales declined 2.8% in Q2, following a 5.4% drop in Q1.

In fact, the underlying improvement in Nordstrom's sales trend was even better than it seemed. Most of the Nordstrom Anniversary Sale -- a key sales driver each summer -- moved into Q3 this year. Excluding this shift, full-price comp sales would have increased last quarter. That's especially impressive because Nordstrom faced its toughest comparison of the year in Q2.

Nordstrom did have a very strong Anniversary Sale, which will mostly be reflected in the company's Q3 results. As a result of its strong Q2 performance and the improving outlook, Nordstrom raised its full-year EPS guidance range from $2.50-$2.70 to $2.60-$2.75.

Retail shares fly higher

Following their big earnings beats on Thursday morning, shares of Macy's skyrocketed 17.1% while Kohl's stock jumped 16.2%. Nordstrom shares also rose 7.5% in sympathy. Following its own earnings beat after the market closed, Nordstrom stock surged another 10.6%.

Despite these big gains, shares of Macy's and Kohl's remain quite cheap. Furthermore, while Nordstrom stock now trades for about 20 times its projected 2016 earnings, that's quite inexpensive given its substantial earnings growth potential. With a little luck and continued solid execution, shares of all three department stores could continue to rise.