How do you know if a stock was a successful investment or not? In my opinion, the key is to look at it on a long enough time scale -- at least five years. This way, shareholders can really consider how a particular company's fundamentals translate to strong share price gains. 

With that long-term framework in mind, let's take a closer look at Dollar General (DG -0.36%). Thanks to growing sales and profits, the discount retail stock has climbed 130% over the past five years, crushing the S&P 500's 55% total return during the same time.

But as investors, we care about what the future holds. So where will Dollar General be in the next five years? Continue reading to learn more about this recession-proof business. 

An expanding physical footprint 

At the end of fiscal 2012, about a decade ago, Dollar General counted 9,961 stores in the U.S. After adding 974 net new stores in the most recent fiscal year, the business now has 19,104 locations (as of Feb. 3). Management plans to open 930 net new stores in the current fiscal year. This is clearly still a company that is prioritizing growth. 

One of Dollar General's unique characteristics is that it operates a lot of locations in lower-cost, rural communities, as compared to solely focusing on higher-density urban and suburban areas. There are two benefits to this. For starters, Dollar General can keep its costs under control as a direct result of being in locations that aren't in huge demand. It doesn't necessarily have to compete with other big-box retailers for real estate. 

Second, because a Dollar General might be the only general merchandise or grocery store in a given community, it benefits from essentially controlling the majority of market share in that area. This helps it drive customer loyalty. 

Right now, Dollar General is in 47 different states. But there is still a sizable expansion runway to continue adding more stores. For example, California looks to be very underpenetrated based on that state's massive size and population. In five years, it's safe to assume that Dollar General will have a much bigger national footprint. 

Strong fundamentals 

An expanding store footprint leads to strong financial results. From fiscal 2017 through fiscal 2022, Dollar General was able to increase its sales at a compound annual rate of 10%, and with more stores in the pipeline, the top line is going to continue marching higher. What's more, fiscal 2020 was the 31st straight year of positive same-store sales. And although they dipped 2.8% in fiscal 2021, same-store sales increased 4.3% in the latest fiscal year. That's the kind of solid gain you want to see from a retail business. 

Dollar General has shown that as its top line increases, its profitability can soar. The company's ability to generate lots of free cash flow has allowed it to reduce its share count, which has led to diluted earnings per share skyrocketing from $5.63 five years ago to $10.68 in fiscal 2022. It's hard not to think that it will be the same story five years from now. 

To be fair, Dollar General isn't without its concerns. Most pressing is the near-term economic uncertainty facing the U.S. right now. Inflation remains elevated, and the Federal Reserve has signaled that it might need to raise interest rates higher than it initially thought. The result could be a severe recession this year, although no one knows for certain. While this could certainly hurt consumers' spending ability, it might shine the spotlight on Dollar General and its attractive budget-friendly value proposition. 

A higher stock price 

With the promise of a larger store count, coupled with higher sales, margins, and profitability, it's easy to believe that Dollar General's share price will also ride this strong fundamental performance to new heights in the next five years. The stock has been a huge winner historically, which could be a good indicator of what's in store going forward. 

As of this writing, shares are trading at a price-to-earnings ratio of under 21. This is roughly in line with the stock's trailing five- and 10-year average valuations, so investors aren't being asked to pay a premium to own the retailer in their portfolios. The stock is down 14% so far in 2023, demonstrating shareholder pessimism. 

For investors who are able to focus on the long-term picture, Dollar General deserves a closer look. The stock is well-positioned to continue rewarding shareholders over the next five years.