Long-term investors have the best chance of retiring with wealth. But holding stocks long-term means weathering all types of financial climates, including recessions. Over time the broader market has always rebounded and returned stronger after recession dips, and the best course of action is to buy great companies and more or less close your eyes.

Costco Wholesale (NASDAQ:COST), Wayfair (NYSE:W), and Amazon (NASDAQ:AMZN) are three great companies that can easily weather a recession.

1. Costco Wholesale: Big, strong, and there when you need it

Shoppers showed what really matters to them during the pandemic, and Costco again demonstrated that it's a master at recession-proof shopping.

A worker in a bulk shopping warehouse.

Image source: Getty Images.

In one sense Costco's shopping model of bulk quantities and membership fees is a total gimmick that competitors could possibly emulate. However, its pared-down warehouses and pallet displays are a no-gimmick. Put differently, Costco has a shopper-centric shopping model that has proven time and time again to be a magnet for American (and global) customers -- something difficult to replicate and has built a moat around its business.

Costco sales generally grow at a fair clip of about 9% each year, but that increased several points during the pandemic. The 2021 first quarter, which included a period that was for the most part post-lockdown, was another outstanding quarter with a 17% sales rise and an 86% increase in digital sales year over year. Total memberships increased 1.6 million in the first quarter to 107.1 million. Executive memberships, which cost twice the standard membership at $120, increased more than half a million. These loyal members are coming to the warehouse king for more than just essentials. However, several of the company's ancillary businesses, such as travel and food court, were either closed or running at a fraction of typical business. 

Fees are an important part of the business, accounting for about a fifth of total sales. Membership retention rate is typically around 90%. The company opened eight new stores in Q1 to make 803 total, and plans to open 20 to 22 for the year.

Costco stock gained 85% over the past three years and pays a dividend that yields 0.79%. It also pays a special dividend on occasion, including $10 in November 2020.

2. Wayfair: A better shopping model

Wayfair's business model isn't meaningfully different from other digital retailers. But what it does, it does well.

A designer living room.

Image source: Getty Images.

As an all-digital shop with a price advantage, the furniture company had a strong sales increase during the pandemic. Sales rose 84% in the second quarter ended June 30 and 67% in the third quarter ended Sept. 30. Wayfair will announce fourth-quarter earnings this week.

The company sees lots of opportunity for continued growth. It has a large addressable market of customers who are still mainly devoted to brick-and-mortar stores, but who are moving in droves to online shopping, with a 15% compound annual growth rate. It pegs online home goods shopping at only 13% saturation, and it also has tailwinds from a increasing number of people coming up on the age of its main shopping contingent of millennials.

Wayfair stock may be somewhat overvalued, trading at 128 times forward one-year earnings. That includes a 29% increase year to date. But over the long term Wayfair has high prospects, and it's demonstrated that it can perform well under adverse circumstances.

3. Amazon: Getting stronger as it changes hands

In case anyone thought Amazon had already reached saturation, the company pulled in an outstanding fourth quarter. It skyrocketed past its own guidance, posting a 44% sales increase and and more than doubling income.

A delivery man with a package standing next to a delivery van.

Image source: Getty Images.

Amazon's digital power positioned it for success during the pandemic, and its convenient shopping options and competitive prices mean that it can thrive during a recession. 

But that performance won't necessarily recede when the pandemic does. Prime membership increased during the fourth quarter ended Dec. 31, and Prime members buy more and engage more with Amazon services such as video and audio.

The company continues to chip away at traditional businesses, offering Amazon Pharmacy and opening digitally enabled supermarkets. It's challenging innovative upstarts such as Etsy with Amazon Handmade and Stitch Fix with its own personal shopping service.

Amazon made a major announcement at the beginning of the month that Jeff Bezos will be handing the reins of the company over to Amazon Web Services head Andy Jassy. But investors needn't worry. Amazon has many projects in the works, and Jassy is a company veteran with leadership experience to bring Amazon to the next level.

Amazon stock gained 124% over the past three years, and although it's pricey at over $3,000 per share, investors can expect more rewards from holding onto its stock long-term.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.