COVID-19 has devastated people and companies across the board. Consumer staples companies like Walmart (NYSE:WMT) and Costco (NASDAQ:COST) have served as one of the few bright spots during these difficult times.

This is not only because they escaped the forced closures that stores such as Kohl's and Macy's have faced. Demand for key staples has also emptied many of their shelves. Consequently, Walmart and Costco have adjusted their hours and gone on unprecedented hiring sprees to keep items stocked.

Walmart stock has increased fractionally year-to-date, and while Costco stock has declined slightly, it has dramatically outperformed the S&P 500. However, while the popularity of consumer staples will act as a stabilizing force for both retailers, making a choice between these stocks likely comes down to factors unrelated to coronavirus. 

The case for Costco

Costco has long been a solid retail performer. With popular products and a 91% membership renewal rate in the U.S. and Canada, its continued expansion across the world has kept the company's profits growing consistently. This has helped Costco withstand challenges from Amazon, as its unique products and omnichannel offerings draw customers to its warehouses and website.

Person with shopping cart squirting hand sanitizer in one hand.

Image source: Getty Images.

Costco has also performed well in an area where both Walmart and Target have struggled -- international expansion. It has succeeded with stores in places such as the U.K., Japan, Australia, and, more recently, China. As of the end of fiscal 2019, it operated 239 warehouses in international markets. In the most recent quarter, Costco's warehouses outside of the U.S. and Canada posted 7.9% comparable sales growth. This was only slightly less than the company's 9.1% comp sales growth in the U.S.

However, this popularity has made Costco shares rather expensive, and the COVID-19 pandemic hasn't changed that. Costco stock ended last week just 11% below its 52-week high. This has the stock trading for 33 times projected earnings for fiscal 2020.

The company's financials may not justify this valuation. Analysts project annual earnings increases to average 6.8% per year over the next five years. At a price-to-earnings-to-growth (PEG) ratio of nearly 5, it has hardly become a buying opportunity. Moreover, even with a 16-year track record of annual payout hikes, Costco's 0.9% dividend yield will not inspire many investors.

What Walmart offers investors

Walmart may struggle to draw investor interest for different reasons. In fiscal 2016, Walmart reported its first net sales decline in decades. Some began to doubt whether Walmart could succeed longer-term. Additionally, with 90% of Americans living within 10 miles of a Walmart, the company has little room for domestic expansion. Its international performance also continues to significantly lag that of its U.S. stores.

However, a successful move into omnichannel retail has changed perceptions about the company. Sales growth in e-commerce, which came in at 33% in the latest quarter, has helped to boost investors' confidence. Moreover, with the purchase of India's Flipkart, Walmart could finally find a successful niche overseas.

Other bright spots have remained. According to Supermarket News, Walmart remains America's largest grocer. This has helped the company enjoy relative success in the midst of the COVID-19 pandemic. With so many Americans living close to a Walmart, the company has been able to serve customers with both in-store and online options. As a result, Walmart stock hasn't been damaged during the recent sell-off and trades near its all-time high.

Indeed, Walmart shares are nearly as pricey as Costco stock. Walmart's forward P/E ratio stands at about 23. Wall Street analysts expect earnings growth to average 5.71% per year over the next five years, placing its PEG ratio at about 4.1. However, one area where Walmart comes out clearly ahead is the dividend. Walmart has increased its dividend for 45 straight years, and its current payout yields about 1.8%.

So, Walmart or Costco?

Considering the advantages and drawbacks of both retailers, this is not an easy call. Costco offers slightly higher growth but has a higher P/E ratio. Conversely, Walmart offers a significantly higher dividend yield. Still, with the S&P 500 as a whole yielding about 2.4%, neither company impresses in this area.

Nonetheless, if forced to choose one stock, I would recommend Costco.

Outside of e-commerce, Walmart has little obvious room for expansion. The company has saturated the U.S. market, and its moves outside of North America have met with notable failures. Conversely, while Costco operates in most large metro areas in the U.S., it still has not tapped most of the midsize markets where Walmart's Sam's Club chain is the only warehouse retailer. As mentioned before, Costco has also succeeded internationally in a way that Walmart has not.

Although investors tend to focus on online growth, physical stores are not going away. With Costco's clear advantage in physical growth, I see it as the more lucrative investment of the two.