When times get tough, basic consumer staples stocks that can bolster your portfolio. Back in the early stages of the pandemic back in March, the stocks of companies that sell basics like household cleaning products and groceries were the ones that held up best.

Two such names were grocery store chain Kroger (KR -0.05%), and Amazon (AMZN -3.04%). Take a look at how these two leading staples stocks fared in comparison to the market when the pandemic took hold:

AMZN Year to Date Total Returns (Daily) Chart

AMZN Year to Date Total Returns (Daily) data by YCharts

Interestingly, both stocks are holdings of Warren Buffett's Berkshire Hathaway (BRK.A -1.11%) (BRK.B -1.33%). Of course, Amazon, known as "the everything store," sells much more than groceries and other household items. Yet Kroger is no slouch, as the largest pure-play grocery chain in America. But with Amazon now up 68% on the year versus Kroger's mere 10% returns, and with Amazon's P/E multiple at 90 versus Kroger's 9.5, which is the better buy today?

A bag of groceries seen up close.

Image source: Getty Images.

A conglomerate versus the specialist

Both companies have seen boom times this year, as people who are stuck at home have stocked up at the grocery store. For the full year, Kroger expects its identical-store sales to grow a whopping 14% -- a huge increase compared with the 2% ID sales it posted in 2019.

That's going to fuel between 50% and 53% earnings growth this year, which probably explains why Kroger's P/E multiple is so low. Clearly, investors believe same-store-sales will stagnate or decline back to a "normal" level once the pandemic passes.

Still, Kroger's windfall has allowed the company to pay down debt and reinvest in its "Restock Kroger" initiatives, which include expanding the company's highly profitable private label brands, along with digital pickup and delivery services covering 98% of Kroger's national footprint. The company also raised its dividend by 13% this year to $0.72 annualized, or about a 2.3% yield. That's on top of share repurchases, which helped reduce shares outstanding by about another 3.3% this year.

In an otherwise expensive market, that's a pretty solid value right there for the market leader in physical U.S. grocery stores.

Can Kroger compete with Amazon's innovations?

Of course, Amazon is a far different beast than Kroger. As the leading U.S. e-commerce site with around 40% market share and the world's leading cloud computing player, Amazon is a huge, diversified technology conglomerate. Not only that, but the pandemic has only reinforced the need for Amazon's services. Aside from e-commerce and cloud, Amazon is growing its Prime subscriptions, which offer video streaming and one-day delivery on many items, and its digital advertising business is growing fast and turning itself into a worthy competitor in the high-margin digital advertising world.

Last quarter, Amazon's revenue growth accelerated 37%, which is hugely impressive for such a big company. Free cash flow grew 26%, but it's really hard to pin down Amazon's actual earnings power, since it is reinvesting so heavily in various growth initiatives.

Two of those new growth businesses could potentially be threats to Kroger. The first is the rollout of Amazon's new Amazon Fresh grocery store concept. This new type of grocery store features "smart cart" technology that eliminates the need to go through a cashier's line, thus taking out a big cost (and time suck) from the grocery business. If that model catches on, it could potentially be disruptive to the grocery industry, Kroger included.

In contrast, Kroger has to deal with labor unions, and actually just inked a new agreement with 20 different unions covering 33,000 employees. Of course, Amazon has also had some labor issues in its past, but if it can roll out a grocery store that can run with fewer employees, it will have an advantage.

In addition, Amazon just rolled out its Amazon online pharmacy, which could be a threat to Kroger's in-store pharmacy business. Amazon is offering free two-day drug delivery for Prime members, covering most health insurance plans, and can offer up to 80% savings. Prescriptions can also be transferred from another pharmacy, but delivery may take more than two days. The U.S. spends $335 billion on prescription medications, so it's another large revenue opportunity where Amazon is trying to unseat incumbents like Kroger.

Which to buy?

For the record, I own both companies and believe them to be good, well-run businesses. I also think that Kroger is holding its own, and if Amazon is to disrupt the grocery space, it will take a very long time. Grocery stores aren't like software businesses that can quickly scale up. It takes time to build new stores, so Kroger's market-leading physical footprint isn't in immediate danger. It's also a very cheap stock for how well-run a company it is.

That being said, I still prefer Amazon, despite its expensive-looking price. Amazon has so many high-quality growth businesses, and has such an innovative culture, that it's hard to bet against it over the long haul. Its wide moat in the highly profitable cloud infrastructure segment should have decades of profitable growth ahead of it, and its Prime membership is one of the more powerful subscription platforms in the world. If the new Amazon Fresh store or Amazon Pharmacy proves a hit, these new innovations could allow Amazon to continue raking in even more share of basic consumer goods and services.

So while Kroger is a fairly safe and cheap dividend stock, Amazon's growth and large opportunities should outperform when looking out over the long-term, not merely 2021.