During the past five years, Amazon.com's revenue has soared 150% to $120.6 billion and the e-commerce giant has severely impaired much of its competition in the process. But two retailers have held up surprisingly well: Costco (COST -0.38%) and Target (TGT -0.41%). Going forward, which company is likely to continue to hold its own in a rapidly changing retail environment, and, more importantly for investors, which stock is the better buy?

Metric

Costco

Target

5-year revenue CAGR

6%

1.8%

5-year EPS CAGR

10%

5.6%

P/E

28

13

Data source: Reuters. 

Costco

Costco is the faster-growing company when comparing it with Target. With earnings per share and revenue increasing at an annualized average rate of 10% and 6%, respectively, during the past five years, the wholesaler has significantly increased the per-share intrinsic value of its shares during this period. Comparatively, Target's EPS and revenue during the same period increased at a CAGR of 5.6% and 1.8%, respectively.

Costco. Image source: The Motley Fool.

Further setting Costco apart, the retailer's prospects for earnings growth over the long haul are likely more sustainable than Target's. Its ability to operate on razor-thin profit margins, thanks to the high loyalty rates of its members and its efficiency at selling bulk goods at unmatched scale, arguably gives Costco a greater competitive advantage against the rise of e-commerce.

But investors will have to pay a steep price for Costco's superior growth track record and more sustainable business model. The company has a price-to-earnings ratio of 28 -- a valuation that prices in at least high-single-digit annualized EPS growth for years to come.

Target

Target may be the slower growing company of these two, but it's undoubtedly the cheaper stock. This is particularly evident in the stock's price-to-earnings ratio of just 13.

Image source: The Motley Fool.

A lower P/E ratio, of course, isn't always better. Indeed, in this case, cheaper may not be the way to go, as the stock is trading at a conservative valuation for a very good reason: Target is struggling with growth and there's no certain remedy.

Target's growth struggles are evident in the company's most recent quarterly report, which included the its first decline in comparable sales in two years. Comparable sales at existing stores decreased 1.1% in Q2. Costco, meanwhile, reported comparable sales growth of 3% in its most recent quarter, when adjusted to exclude the negative impact of gasoline deflation and foreign exchange rates, and even without these adjustments, Costco's comparable sales were flat.

To fight declining sales, Target recently announced a smaller, more focused store format aimed at millennials.

"[These smaller stores] could be a huge part of future growth outlook over time," Target CEO Brian Cornell recently told The Wall Street Journal.

Of course, the very fact that Target has to try something new in hopes to return to growth is a sign of the uncertainty surrounding the company's future.

One nice bonus Target investors do get, however, is a high dividend yield of 3.5%. Costco's dividend yield of just 1.1% pales in comparison. This is one of the benefits of the lower expectations for Target than Costco.

So, which company is the better buy? Choosing between these two stocks really boils down to betting on a strong competitive advantage at a higher price (Costco) or a less certain outcome at a much cheaper price (Target). I'd personally bet on Costco. Its strong growth over the last five years and its differentiated, highly scaled business model arguably make it more resilient to the rise of e-commerce and worth its pricier valuation.