Only the strongest retailers are likely to survive e-commerce's relentless assault. Those that emerge as true omnichannel retailers will be best positioned to win in this increasingly online world, while those that fail to adapt to changing consumer trends will fall by the wayside.

In this regard, Costco Wholesale (NASDAQ:COST) and Target (NYSE:TGT) are two retailers with strong in-store shopping experiences and burgeoning e-commerce operations, which gives them an edge over many of their rivals. But which is the better buy today? Let's find out.

A keyboard button labeled "add to cart."

Image source: Getty Images.

Moat

Target's in-store strategy is built upon a more pleasant shopping experience than heavy discounters such as Walmart, with only slightly higher prices. This formula has worked well with higher-income shoppers. Yet it also places Target squarely in e-commerce juggernaut Amazon.com's crosshairs, as affluent consumers are increasingly choosing the convenience of online shopping. Perhaps even more worrisome is Amazon's recent purchase of leading natural and organic grocer Whole Foods; the combined company poses a serious threat to Target's vital grocery business.

In turn, Target has been forced to invest aggressively in its online operations. Target recently began offering free-two-day-shipping to better compete with Amazon's and Walmart's free shipping options. It also acquired Shipt for $550 million, which will help it roll out same-day delivery from many of its stores. Going forward, Target believes that by using its 1,800 stores as the core of its fulfillment network, it will be able to offer attractive shipping options for its customers without having to incur the expense of building out dedicated distribution centers. However, time will tell whether Target can compete effectively with the likes of Amazon and Walmart with this approach.

A Target storefront.

Target's stores also serve as mini-fulfillment centers. Image source: Target.

Costco's competitive strategy centers on its membership model. For an annual fee ranging from $60 to $120, the warehouse chain offers ultra-low prices on a well-curated selection of goods. Costco's stores tend to stock limited amounts of these products and change their merchandise selection frequently. This creates a dopamine-inducing, treasure hunt-type experience that drives continual traffic to its stores. It also helps to insulate it from online competition.

Yet despite its strong in-store performance, Costco is adapting to the trend toward online shopping by expanding its own e-commerce operations. Costco recently began offering free-two-day-shipping on certain orders, and it also partnered with Instacart to offer same-day delivery. Together, these initiatives have helped to drive Costco's e-commerce sales more than 35% higher in the third quarter.

All told, Costco's powerful membership model gives it perhaps the widest economic moat among all traditional retailers. With its strong new member growth and impressive retention rates -- and with its e-commerce business expanding rapidly -- Costco is better positioned than Target to compete and win in the retail war in the years ahead.

Advantage: Costco

Financial fortitude

Let's now take a look at some key financial metrics to see how these two retailers compare.

Metric

Costco Wholesale

Target

Revenue

$139.47 billion

$72.44 billion

Operating income

$4.48 billion

$4.20 billion

Net income

$3.01 billion

$2.97 billion

Operating cash flow

$6.05 billion

$6.13 billion

Free cash flow

$3.36 billion

$3.26 billion

Cash & investments

$7.04 billion

$1.06 billion

Debt

$6.49 billion

$13.56 billion

Data sources: Morningstar, Yahoo! Finance.

Costco and Target are remarkably similar in terms of profit and cash flow production. These two retailers separate, however, when it comes to their balance sheets. Costco has more than $500 million in net cash, while Target has $12.5 billion in net debt. Therefore, the edge goes to Costco for financial strength.

Advantage: Costco 

Growth

Costco is projected to increase its revenue by nearly 9% in 2018 and 7% in 2019. Additionally, analysts forecast that Costco's earnings per share will rise by about 12% annually over the next half-decade, fueled by new store openings and industry-leading same-store sales growth.

Target, meanwhile, is expected to grow its sales by less than 3% this year and 2% next year. Moreover, Target's EPS is anticipated to rise by only 6.5% annually over the next five years, as it continues to spend heavily on higher wages, store renovations, and e-commerce technology.

Thus, Costco has a clear edge in terms of expected revenue and earnings growth in the coming years.

Advantage: Costco

Valuation

Finally, let's evaluate some valuation metrics for Costco and Target, including price-to-sales, price-to-free cash flow, price-to-earnings, and price-to-earnings-to-growth ratios.

Metric

Costco Wholesale

Target

P/S

0.66

0.57

P/FCF

27.51

12.73

Trailing P/E

30.87

14.28

Forward P/E

27.47

14.22

PEG

2.50

2.24

Data source: Yahoo! Finance.

On all five metrics, Target's shares are significantly less expensive than that of Costco. Even when we account for Costco's higher expected EPS growth rate, Target's stock is still less costly, as can be seen in its lower PEG ratio. So in terms of valuation, Target's shares are more attractively priced.

Advantage: Target

The better buy is...

Target's stock may be cheaper, but with its stronger competitive position, superior balance sheet strength, and greater growth prospects, Costco is the better buy today.

John Mackey, CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool's board of directors. Joe Tenebruso has no position in any of the stocks mentioned. The Motley Fool owns shares of and recommends Amazon. The Motley Fool recommends Costco Wholesale. The Motley Fool has a disclosure policy.