With more than 19,000 locations, there's no question that Dollar General (DG -0.59%) is one of the largest retail businesses in the country. Its focus on providing customers with low-cost merchandise has made it a thriving company, with consistently rising sales and profits over time. 

And the stock has mirrored this strong fundamental performance. Despite being down 17% from their all-time high (as of this writing), shares of Dollar General have produced a stellar return of 122% over the past five years. Not only has this gain beaten that of the S&P 500 index by a huge margin, but it just might continue in the years ahead. 

And that's why investors should consider buying this top retail stock. Let's take a closer look. 

Facing the macro situation 

With its focus on value as its overarching competitive strategy, Dollar General is proving resilient at a time when inflationary pressures hurt consumers' ability to spend. During fiscal 2022, which ended Feb. 3, Dollar General posted revenue of $37.8 billion, up 10.6% year over year. And in the most recent fourth quarter, the business saw sales jump 17.9%. This marked the fourth straight fiscal quarter that revenue rose at an accelerating rate, a clear indicator of Dollar General's value proposition in today's economy. 

Management is trying to better position Dollar General in what is a very competitive retail industry. It plans on spending close to $2 billion in capital expenditures this year, substantially more than Wall Street analysts were expecting. The money will be mostly for store updates and improvements in distribution capabilities, which is usually the case. 

But a big area of focus will be to better staff stores and to enhance the customer experience. I think this is absolutely the right approach. As customers are forced to stretch their budgets and decide to trade down to places like Dollar General, it's paramount that the business is prepared to handle this new demand. 

It'll continue to be a sluggish economy full of uncertainty. Management forecasts a 5.5% to 6% increase in sales in fiscal 2023. "We anticipate the challenging economic and operating environment to continue into 2023, but we believe we are well-positioned to drive strong growth as we move throughout the year," CFO John Garratt said optimistically on the Q4 2022 earnings call. 

More bullish arguments 

As I touched on above, an easy case can be made that Dollar General was made to thrive in this type of economic environment. But even before the pandemic, for example, sales were rising consistently in the high single digits, with earnings per share (EPS) generally rising at a much faster pace. Therefore, this has been a successful company for quite some time. 

Even with its massive physical footprint, there are still sizable growth opportunities. The business plans to open 1,050 new stores in the current fiscal year. That type of growth on an already huge store base likely means there is still a meaningful runway to justify continued expansion. That's something shareholders can get excited about. 

Although Dollar General has been a winning investment, the stock currently trades at a reasonable price-to-earnings ratio of 20. This is in line with the stock's trailing-10-year average, and it's just slightly more expensive than the S&P 500, which trades at a P/E multiple of 18.6 (as of this writing). This is despite Dollar General arguably being a much better business than the average company. This seems like an attractive valuation to me.

Dollar General has been a sustainable producer of positive net income, and it has generated lots of free cash flow. This means that even after investing in growth initiatives, the company has conducted generous capital return actions. Dollar General pays a quarterly dividend of $0.59 per share. And over the last 10 fiscal years, it has reduced the outstanding share count by 32%. This can improve investor returns by boosting EPS. 

Looking at all the information, there's a lot to like about Dollar General. And that's why investors might consider buying the stock right now.