When it comes to retail giant Costco Wholesale (COST -1.72%), there are plenty of things filling up the headlines. First and foremost, Costco stock just crossed $1,000 per share for the first time. For perspective, it traded closer to $100 per share 10 years ago.

Costco stock is up, simply put, because business is good. For example, in the fiscal first quarter of 2025 (which ended on Nov. 24), the company's net sales were up 7.5% year over year. That might not sound like much. But it generates over $250 billion in annual revenue, which means a 7.5% quarterly gain is massive.

One reason to love Costco stock is its chances of long-term resilience thanks to its business model. To shop at Costco, you need to pay for a membership. And while membership fees might only account for less than 2% of its revenue, this is the key to how the business model works.

In short, Costco's members pay their annual fees, which allows the company to sell its products as cheaply as possible. Members consequently feel as though they're getting good value when shopping there. And they're loyal to the brand since they've already paid for the privilege of shopping there.

The good news is that Costco's membership base has gotten younger in recent years. In its fiscal 2024, around half of new members were younger than 40 years old. That's a good sign when thinking about the coming decades of this business.

All of this said, I feel like too many investors are sleeping on the significance of Costco's e-commerce growth. Q1 e-commerce sales were up 13% year over year. And growth here may help unlock a new key to the future success of the business.

Why Costco's e-commerce growth matters

To better frame this story, I want to point out recent developments at Walmart. Over the past year, the retail giant has been doing exactly what any investor would want to see. Revenue is up, which is good. But gross profit is up by a larger amount. And operating income has improved better than both.

WMT Revenue (TTM) Chart

WMT Revenue (TTM) data by YCharts

When looking at a chart such as this, investors should ask what is allowing Walmart's profit margins to improve. Well, one big driver has been advertising. In the company's fiscal third quarter of 2025 (which ended in October), global advertising grew 28% year over year.

As Walmart's management said in the Q3 earnings call, "We're building a highly unique retail media platform and have been encouraged by ongoing tests showing customer receptivity to growth in digital ads."

Retail media is when a retailer, such as Walmart, leverages its shopping data and offers advertisers space on digital platforms to reach new customers. In other words, without a thriving e-commerce website, generating high-margin revenue through retail media is a tough go. But Walmart does have a thriving e-commerce business -- it generates over $100 billion in annual sales.

In summary, the strength of Walmart's e-commerce business unlocked a higher-margin revenue stream. And now the company's profits are growing faster than revenue, lifting the stock.

Turning back to Costco, this is exactly the path that it's on. As CFO Gary Millerchip said on the Q1 2025 earnings call, "We are very much in the early innings with retail media, but we continue to believe this represents a significant growth opportunity in the future."

Keep in mind that even though Costco is huge, its profits are relatively small. It has just $9.3 billion in trailing-12-month operating profits. Therefore, it wouldn't take much to move the needle in a big way. And this is why 13% growth for e-commerce is so huge. It's not about the e-commerce as an end in itself. It's a step to unlocking the "significant growth opportunity" of retail media.

It won't happen overnight. But for those who thought they already knew Costco's story, there are still important chapters yet to be written.