Costco (COST 1.01%) needs no introduction. The dominant warehouse club operator is a consumer favorite. And it has undoubtedly been a big winner for shareholders.

This top retail stock has soared 237% in the last five years, a gain that trounces the S&P 500 and the Nasdaq Composite index by a wide margin. Even in 2024, shares have climbed 8% so far (as of Feb. 13) as the momentum continues.

There are certainly numerous reasons to appreciate this company. But there's also a key risk that investors need to know about.

What makes Costco a wonderful business?

It's no surprise that for a stock to perform well over time, the fundamentals have to be stellar. Costco has been able to increase net sales and diluted earnings per share at compound annual rates in the double digits in the last five years. For the world's third-biggest retailer, these growth rates are impressive.

The durability of Costco stands out, particularly as it relates to the economic backdrop. Just look at what happened during the coronavirus pandemic. The company reported 17.5% top-line growth in fiscal 2021 and a 15.8% gain in fiscal 2022 due to strong demand from shoppers.

Investors should have confidence in Costco's ability to continue posting solid financial results in recessionary or inflationary periods. That's because it sells high-quality merchandise at some of the lowest prices around. This is what customers value at all times.

Costco's brand in the retail sector is a notable competitive advantage, but I think the company's massive scale is what gives it real leverage. Buying goods from suppliers in the quantities Costco does allows it to obtain favorable pricing, and these savings get passed onto the shopper. From the supplier's perspective, they almost have no choice but to do business with Costco, unless they want to lose out on a lot of revenue.

This is also a special company because it continues to successfully defend itself against the threat of disruption. Online shopping continues to grow as a percentage of overall retail sales in the U.S. and abroad, but Costco's revenue and earnings keep rising with each passing year. This clearly demonstrates the value that consumers find in their memberships, despite a tech giant like Amazon finding outsize success in the industry.

Reducing the chance of market-beating returns

Nothing I've mentioned up to this point would point to this being a terrible investment opportunity. However, there is one critical factor that could result in poor investment returns going forward: the current valuation.

As of this writing, Costco shares trade at a price-to-earnings (P/E) ratio of 48.7. This represents a sizable 45% premium to the stock's trailing-10-year average multiple. In fact, the current valuation is about as expensive as shares have been in the last decade. Investors steadily bid up the stock because of the company's fantastic financial performance. They're fully aware of how great of a business this is.

Therefore, there's really no opportunity to "be greedy when others are fearful," as Warren Buffett is known for saying. No one is fearful about Costco's prospects.

Because the price one initially pays has a profound impact on the potential for returns, the current valuation is the biggest risk facing prospective investors, in my opinion. This creates a huge headwind for generating strong gains going forward.

To be clear, if you're extremely bullish on the future of Costco over the next decade -- specifically, you believe it can grow at an even faster clip than it did in the past -- then perhaps the stock is a no-brainer buy. But I believe there's no reason to have this perspective. Consequently, investors should think twice before buying shares today, especially if they hope to beat the market.