There are two types of stocks that should be at the top of your buying list when the next recession rolls in.

You will want to pick up shares of objectively great companies that are sure to weather any storm. Their shares may go on fire sale due to concerns about the market, the global or local economy, changing consumer trends, or a gazillion other worries, but their long-term business prospects are not going away and you should buy them on the dip.

And then you have companies that actually do better during market downturns. Maybe it's a discount retailer that sees more in-store activity when people's personal budgets are tight. Perhaps you're looking at an alternative transportation and travel stock that thrives when airlines struggle. Or, you could be thinking about an upstart with disruptive business ideas that is just waiting for its turn in the spotlight -- and the particular conditions of the next recession might deliver the right mix of ingredients.

On that note, I'll show you a household name for the ages that also happens to benefit from tight consumer budgets. It's the best of both worlds. Keep an eye on this ticker so you can take action when the opportunity presents itself. Remember, even the worst recession will pass.

A classic low-cost retailer

Warehouse retailer Costco Wholesale (COST 1.01%) is one of those stocks you can buy, stick under your proverbial pillow, and leave untouched for decades. You won't lose a minute of sleep over Costco's survival, and the stock tends to crush the broader market when times are tough.

The most obvious example of Costco's recession-proof nature is its performance during the early days of the COVID-19 crisis. The S&P 500 market index fell 20% in the first three months of 2020, but Costco's shares closed the quarter just 3% lower. The company's revenue growth took a meaningful upward turn that summer, accelerating an already impressive top-line trend. Free cash flows experienced an even greater boost, and Costco has maintained this high performance ever since.

A group of friends shopping in the produce section of a grocery store.

Image source: Getty Images.

There's no way to know what might cause the next marketwide downturn, but you can bet that Costco will be ready to face the new challenges. This company was built around a rock-solid business plan that churns through massive volumes of retail revenues and generates most of its profits from subscription-style membership fees.

So Costco tends to beat the market in the best of times and the worst of times. Patient shareholders have enjoyed a return of 1,360% over the last two decades, a period that includes two sharp recessions and many years of economic recovery. The S&P 500 merely quadrupled over the same time span.

COST Chart

COST data by YCharts. The grey sectors show U.S. market recessions.

Do I have to wait for a market crash?

As I said earlier, Costco is a stock for all seasons. If you need a rock-solid investment that will serve you well for many years to come, you won't go far wrong with this ticker. You may end up paying a premium from time to time, but it's never a bad time to start a Costco position.

That being said, the stock has been crushing the market in recent years and trades at sky-high valuation ratios today. Changing hands at 46 times trailing earnings and 55 times free cash flows, Costco's stock is running hot right now.

You don't have to wait for a marketwide downturn, though. Just keep some dry powder ready so you can pounce on Costco the next time its stock takes a haircut. And during the next recession -- because there will always be more downturns in the long haul -- I'm sure you'll be able to load up on Costco shares at more comfortable prices.