What happened

Shares of Dollar Tree (DLTR 0.04%) were down by 10% as of 12:12 p.m. ET on Thursday despite the discount retailer reporting fiscal second-quarter earnings that beat Wall Street's consensus estimate.

For the period, which ended July 29, same-store sales were up by 6.9% overall, with comps at its Dollar Tree chain up by 7.8% and the Family Dollar chain up by 5.8%. 

Earnings per share came in at $0.91 -- better than the consensus estimate, which had called for $0.87. But the company guided for lower earnings than the Street's estimates, which contributed to the stock's decline on Thursday.

So what

There has been heightened concern on Wall Street about the near-term demand trends for the retail industry. Some retailers are pointing to softening demand trends in their outlooks, and reporting that their inventory growth is outpacing their revenue growth. Such conditions usually lead to near-term difficulties for these companies, and Dollar Tree's commentary fed into the negative sentiment.

While executives on the earnings call noted there is nothing structural happening right now that changes their long-term outlook about growth, Dollar Tree is still experiencing some headwinds to sales from consumers reserving their purchases for everyday necessities in consumables.  

After the fiscal Q2 earnings beat, management said it expects earnings per share for fiscal Q3 will be between $0.94 to $1.04. Analysts were expecting earnings per share of $1.29.

The shift in sales toward more lower-priced items and the company's elevated inventory levels are putting pressure on its margins, which seems to have caused management's earnings guidance to come in below analysts' consensus estimates. While Dollar Tree's sales are up 7% in the current fiscal year, adjusted earnings per share are down 40%. 

Now what

The good thing about the day's sell-off is that it leaves the stock's valuation at a more attractive level. Its current forward price-to-earnings ratio of 21 is a better deal than its ratio of 25 before the earnings report. 

Nothing has changed Dollar Tree's competitive position. While its earnings are down, its free cash flow is improving. Its sales and market share are still growing. These are good signs for investors over the long term.