Costco Wholesale (COST -0.09%) shareholders had a good 2022. Sure, the warehouse retailer's stock was down for the year, losing about 15% through mid-December. Shares looked especially weak following the Dec. 8 earnings report that showed some signs of stress on the business during the key holiday shopping season.

But Costco's returns have edged past the S&P 500 for the year. The business notched some key wins, too, including boosting its membership base and keeping customer traffic climbing even compared to huge growth a year ago.

With that big picture in mind, let's look at where the stock might be headed over the next several years.

Bigger sales base

Costco's post-pandemic trends illustrate why Wall Street is so bullish about this business over the long term. The company notched a 4% customer traffic increase in the most recent quarter, even as many peer retailers, including Target and Home Depot, endured slowdowns or declines.

Costco's position as a price leader is clearly helping it stand out at a time when many shoppers are looking to save money. That draw shows up in many of its operating metrics, but one standout is the membership base. Costco boosted its paying subscriber base by 7% this past quarter to roughly 67 million households .

Success there suggests the retailer has a clear path toward steady revenue growth over the next five years through a combination of higher customer traffic and increased spending per visit.

More profits

Costco has a low profit margin even compared to discount rivals like Walmart (WMT -0.84%). That's a deliberate part of its business approach, which relies on membership fees to deliver most of its earnings while gross profitability stays low.

COST Gross Profit Margin Chart

COST gross profit margin; data by YCharts.

Yet there's likely good news on the way here, too. Costco typically raises its annual membership fees about every five years. It has been roughly that long since its last increase, which means 2023 could see an immediate boost to its bottom line.

There's every reason to think Costco has a firm foundation to raise that price, too. The company's renewal rate edged up again this past quarter. In the fiscal first quarter, an incredible 92.5% of members in the core U.S. market chose to renew their memberships, up from 92.4% in the previous quarter.

Costco could hardly ask for a more-accommodating environment to raise its fees, then, as its value proposition is most clear during inflationary times like these.

Where is the stock headed?

It's anyone's guess where Costco's stock will be in a few months, but the long-term outlook isn't so cloudy.

The chain is winning market share and has room to steadily increase its sales footprint both online and through its physical warehouses. Sure, some parts of the business are shrinking compared to soaring growth in earlier phases of the pandemic. But Costco's wide merchandising approach allows it to expand even during cyclical downturns.

Its membership-fee income also insulates the company from some of the worst potential earnings declines during a recession. Put all of these assets together, and you have a compelling bullish case.

Costco's stock isn't cheap compared to peers like Walmart and Target. But there are good reasons for the premium valuation. This retailer should deliver good returns for investors over the next five years, or longer.