Costco Wholesale (COST 0.17%) is one of those rare businesses that can perform well through a wide range of selling environments. Its aisles were packed in the early phases of the pandemic, for example, as people stocked up on essentials even as economic growth rates plunged. Shoppers frequented its stores even more during the subsequent rebound when they directed more cash toward discretionary purchases like home furnishings.

Wall Street's worry about a recession on the way pushed Costco's stock down in the past year, along with the wider market. But the warehouse retailer is primed to outperform in a downturn while likely leading the industry through the inevitable recovery ahead. Let's look at three reasons why.

1. Costco shoppers are loyal

Customer loyalty isn't common in the retailing world, where competition is fierce, and consumer preferences are always shifting. Costco has a knack for holding on to its shoppers, though, through booms and busts.

Its renewal rate, or the rate at which existing members renew their subscriptions, is near a record high of 92.5% in the third quarter, up from 92.4% in the prior quarter. That figure is rising despite the fact that Costco makes it incredibly easy to cancel your membership. The retailer even promises to return your entire annual fee if you aren't satisfied.

Hardly anyone takes Costco up on that generous offer, and that loyalty shows up in areas like customer traffic, which was up 2.2% in the core U.S. market last quarter. Walmart's comparable figure was 1.8%.

2. Margins are already low

It might seem odd to recommend a stock based on its low margins, but don't tune out just yet. Costco generates an operating margin of just over 3% of sales, and you can do far better with companies outside of the retailing industry. Microsoft and McDonald's, for example, both sport margins above 40% of sales.

COST Operating Margin (TTM) Chart.

COST Operating Margin (TTM) data by YCharts.

Yet Costco's earnings are highly predictable and unlikely to materially worsen. Most of its profits come from subscription fees, after all. Those fees aren't nearly as volatile as demand trends can be.

Costco is also due for another increase to its annual fee, which tends to occur about every five years or so. The 2023 year might be an ideal one to roll out higher rates, given its high customer loyalty in this inflationary era. That move might help push the operating margin above Walmart's.

3. It's time to bulk up

These positive factors are well-known on Wall Street. That's a key reason why Costco's stock never seems especially cheap. You have to pay nearly 1 time annual sales for shares right now, compared to 0.6 times for Walmart.

But its valuation is down from a high of about 1.25 times sales in 2022. Sure, the retailer is likely to see slower growth this year as compared to booming results in the previous two years.

But it continues to win market share, mainly by delivering unbeatable value to its growing pool of subscribers. As long as the company continues down that proven path, the stock is likely to beat the market over time.