Costco (COST 1.01%) has had an incredible rise over the last 10 years. The big box retailer has seen its share price grow 367%, far exceeding its closest competitors in the retail industry. But the last year has been tough on the company.

Chart showing Costco's price higher than Target's and Walmart's since 2015.

COST data by YCharts

The stock market correction, high inflation, supply chain challenges, and a slowing economy have pushed the stock down 20% from its high. Does that mean this top-tier retail stock is a bargain buy today? Let's take a deeper dive to see if now is the right time to invest in Costco.

Things are slowing

Costco was one of the many retailers to benefit from the pandemic shopping boom. Sales and revenues reached record levels between 2020 and 2022. However, demand is now slowing. Costco's most recent earnings report for March 2023 saw a 0.5% increase year over year in net sales, while comparable sales were down 1.1% compared to the previous five weeks.

This isn't a huge surprise, as inflation continues to affect consumer spending. But it definitely is a big change from the gains Costco achieved in March 2022, where comparable sales grew by 17% compared to the previous five weeks and net sales rose 18.7% over the year prior.

Costco has been facing a slew of challenges, including currency fluctuations, high inflation, and supply chain issues, most of which aren't expected to subside anytime soon. But that doesn't mean investors should steer clear.

Taking a holistic point of view

Costco currently serves 68 million households across its 850 warehouses in 14 countries. Each month it makes billions of dollars in sales. Buying in bulk and being such a massive retailer means it gains pricing advantages. This is one of the reasons it's still seeing positive growth even though things are slowing.

Membership fees, which make up a large portion of the company's earnings, are still up year over year. Its net income per share and diluted earnings per share are up, too.

Costco February 2023 12 week gains.

Author's calculations from February 2023 earnings report and Y-Charts.

While there's no way to know exactly what people will do if and when a recession happens, there is a good chance sales will remain stable even in a recessionary period, because Costco passes the favorable pricing it gets on bulk goods to its customers.

The company has hinted that it will eventually increase its membership fees, although the exact timeline of when that could happen hasn't been made clear yet. But even a small bump in annual fees would be enough to affect the slowdown it's seeing. It still has a lot of room for added growth as it expands into new and existing international markets, too.

Even though the stock is down 20% from its recent high, it still trades at a notable premium. Its price-to-earnings (P/E) ratio is 36, which is much higher than the majority of its retail peers.

Chart showing Costco's PE ratio higher than several of its peers' in 2023.

COST PE Ratio data by YCharts

However, I feel its track record for growth -- providing a 370% total return over the last 10 years -- and its long-term prospects make up for its premium pricing. These aspects make Costco stock a buy.