They're both great companies, to be sure. Amazon (NASDAQ:AMZN) is the king of e-commerce, while Dollar General (NYSE:DG) has chiseled out a place for itself in the brick-and-mortar retailing world by doing things differently than Walmart.

Both stocks have performed well, too. Dollar General is up more than 200% for the past five years, while Amazon has gained well over 300% for the same timeframe. Most investors would he happy with either result, and there's little reason to think both names won't continue to do well.

If there's only room for one of these stocks in your portfolio, though, right now it's got to be Amazon.

Two young boys arguing.

Image source: Getty Images.

Why not Dollar General?

Don't misread the message. Dollar General's going to be fine. An expanded frozen foods lineup and more fresh produce presence holds great promise, while plans for a new store brand aimed at higher earners is a compelling pivot.

It would be naive, however, to believe the company isn't running out of ways and places to grow.

As of the latest count, more than 16,700 Dollar General stores are peppered across 46 different states. Most of those locations -- about 75% -- are found in towns with populations of 20,000 or less.

With nearly 17,000 locales already up and running, there aren't many of these smaller towns left to tap. Recent Census Bureau data indicates there are fewer than 19,500 incorporated cities in the U.S. Fewer than 800 of them report populations in excess of 50,000, while around 14,800 of these towns have populations of fewer than 5,000 residents. This only leaves about 4,000 cities in Dollar General's proverbial sweet spot, where the market is neither too big nor too small.

That's not to suggest the retailer can't (or won't) open more than one location in a particular town, or venture into larger markets. That's not its most familiar customer base, however.

Its new store venture called Popshelf opens a whole new set of doors. Unveiled in October, the company is piloting these stores in suburbs of metropolitan areas, targeting consumers who live in households with annual earnings of between $50,000 and $125,000, offering these consumers value-minded discretionary goods. In the suburbs of bigger cities, Dollar General will be going head-to-head with the likes of Five Below, Party City, and even Walmart, just to name a few.

Given this already established competition where the retailer is looking to put down new roots, in some ways the move is a tacit acknowledgment that Dollar General has pretty well saturated its most proven markets.

Why Amazon?

As big as Amazon is, it's still got room to grow.

It's the biggest e-commerce player in the U.S. -- that's not in dispute. But according to eMarketer, it only controls a little less than 40% of the country's online shopping market. It's even less of a factor overseas, where it competes with the likes of Alibaba and JD.com. This year's international product sales revenue is less than half of its U.S. revenue, even though it's got the entire rest of the world to address.

This isn't necessarily a sign of weakness, however. Rather, it represents established e-commerce spending that can be taken away from its rivals -- if Amazon plays its cards right.

There's an even bigger growth opportunity for Amazon, however, here and abroad. Despite the $602 billion U.S. consumers spent online last year, according to Digital Commerce 360, that's still only 16% of the nation's total retail spending. The other 84% is up for grabs.

Clearly not all of that business will ever be won by Amazon, or even by a rival e-commerce platform. Perishable foods require special handling, for instance, and bulky furniture can be difficult and expensive to deliver. Nevertheless, with last year's e-commerce revenue growth of 13.6% in the U.S. and Digital Commerce 360's growth estimate of nearly 18% in worldwide online shopping sales, Amazon is benefiting from a rising tide.

The pandemic has only exacerbated this growth, which Amazon fielded perfectly.

This bears out in the numbers. The company's total revenue through the first nine months of the year is up 35%. Operating income is higher by 50%. Those aren't the numbers that are so encouraging, however. Far more exciting is the fact that, according to Consumer Intelligence Research Partners, Amazon has brought 14 million new U.S. Prime subscribers into the fold since the end of last year. That should put the current tally at 126 million U.S. members, which is Amazon's best quarterly growth in nearly three years.

Take the numbers with a grain of salt. Amazon has only confirmed it serves more than 150 million worldwide Prime members without breaking down where they live. But given the COVID-19 backdrop that turned lots of consumers into highly skilled online shoppers, the estimate seems credible.

It matters. Prime members are known to spend considerably more at Amazon.com than non-Prime shoppers, and most of the company's business comes from within the U.S. With so many new users brought into the company's ecosystem, Amazon's got a good shot at maintaining outsized sales growth even when the pandemic is in the rearview mirror.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.