There are lots of fantastic consumer goods companies for investors to buy these days, many of which have long track records of beating the market and years of solid financial performance. One of the largest consumer goods companies is Costco Wholesale (COST -0.40%), a popular discount warehouse club.

The company has the second-largest market cap in the consumer goods sector, according to research from The Motley Fool, reaching $435 billion. Only Walmart is larger, putting Costco in a very exclusive club.

Investors love Costco stock, considering that it has nearly doubled in value over the past three years. Those impressive gains, along with the company's growth, have some investors wondering whether now is the right time to buy Costco. Here's what the company is doing right and why it's likely a smart move to add this stock to your portfolio.

A person looking at clothes.

Image source: Getty Images.

What Costco is doing right

Some people may be surprised to learn that Costco generates most of its profit not from the products it sells in its warehouses, but rather from its membership fees. Costco has done a fantastic job of creating value for its members through its low-cost items, resulting in an impressive 93% renewal rate for Costco memberships.

Those renewals and the company's ability to attract new members have resulted in Costco having 140.6 million members at the end of the fiscal third quarter (which ended on May 11), an increase of nearly 7% from the year-ago quarter.

Costco's sales and earnings are impressive as well, with revenue increasing 8% in the quarter to $62 million and diluted earnings per share rising 13% to $4.28. Comparable-store sales were up by about 6% in the quarter, and e-commerce sales jumped by about 15%.

And more growth could be on the way for Costco, with management saying it will end fiscal 2025 with 24 new warehouses, giving it nearly 1,000 locations worldwide.

Why Costco stock is a buy right now

Like many other stocks, Costco's shares aren't exactly cheap. The company's shares have a price-to-earnings ratio of 55, compared to an average P/E multiple of 29 for the S&P 500 index.

But Costco's sales, earnings, and customer growth make the stock's elevated valuation more palatable. And the fact that the broader market is experiencing higher valuations than historically normal means that paying more for Costco right now probably isn't too much of a concern.

What's more, Costco's business model appears stronger than ever. Recent data shows that one-third of Costco's members have an average household income of $125,000 or higher. This is important because it indicates that Costco's business may be more resilient during a recession or economic slowdown than some of its peers.

While recession fears have somewhat tapered off as of late, there's still some uncertainty about what will happen with tariffs and how they might impact consumer spending. With Costco's high membership retention rates and a large portion of its members having a higher household income, it's likely Costco can weather any potential macroeconomic storm.

For investors looking for a consumer goods company with a fantastic business model, increasing sales and earnings, and a widening customer base, it's hard to beat Costco stock. If you're concerned about its valuation, it may be wise to implement dollar-cost averaging, starting with just a small position and adding more to it consistently over time.