Walmart (WMT -0.32%) is taking share from Amazon's (AMZN -1.11%) most profitable business.

Buried deep in Walmart's investor presentation was a tiny tidbit that showed Walmart is making strong inroads in its advertising business. That wasn't fully unexpected after the company instituted several changes to its advertising platform to spur greater spending. But the amount of growth was much better than anticipated.

Walmart's ad sales increased 40% year over year in the U.S., and up 30% globally. That kind of growth offers strong support for its e-commerce operations.

What's driving growth in e-commerce?

Walmart's U.S. e-commerce sales increased 16% year over year last quarter. That compares extremely favorably with its fellow U.S. big-box retailer, Target, which saw digitally originated sales grow just 0.3% last quarter.

Management noted its e-commerce sales were driven by "40% growth in advertising as well as strength in pickup & delivery, marketplace, and fulfillment services." In other words, it's the third-party sellers and the services Walmart offers them driving the company's e-commerce sales.

That's a great strategy, and one Target and other retailers have failed to take advantage of. Target's marketplace business remains minuscule compared to Walmart, leaving it with no opportunity to build an advertising business. While Target offers fulfillment services through Shipt, it's less of an Amazon and Walmart competitor and more of an Instacart competitor.

Advertising revenue is extremely high margin, which can help offset some of the added costs of e-commerce. Walmart had been losing hundreds of millions on its e-commerce expansion efforts, but advertising and third-party seller services should help it offset those losses eventually, if they haven't already.

Is Walmart finally taking share from Amazon?

Amazon saw its global online sales grow just 7% last quarter. That number was heavily impacted by foreign exchange rates. The FX-neutral growth would have been 13%.

Either way you slice it, that's still less than the 16% growth Walmart saw in its domestic online sales.

But online sales are just part of the picture for Amazon. It has a robust advertising business, offers marketplace and fulfillment services to third-party merchants, and has a massive Prime subscription business. Those are the exact factors Walmart points to as the driving force behind its e-commerce success, and what separates it from other retailers like Target.

Amazon's entire retail business in North America grew 20% year over year, with its physical stores actually dragging down that growth. That's the best comparison to Walmart's 16% growth in e-commerce.

That is to say, Walmart's strategy is helping it execute better than its fellow big-box retailers, but Amazon remains extremely resilient.

Should you buy shares of Walmart?

Walmart is certainly performing better than Target and many other retailers that primarily sell goods through physical stores. That said, the future of retail growth is going to come from e-commerce. And there's no touching Amazon in that regard.

Walmart may be growing its advertising business faster than Amazon, but it's also growing off a much smaller base. And with its overall e-commerce business growing slower than Amazon's total e-commerce business in North America, it seems unsustainable for Walmart to outpace Amazon's advertising segment to the point of taking meaningful market share.

That said, Walmart's physical stores attracted a lot of customers last quarter, as high inflation led consumers to seek lower prices touted by Walmart. That makes Walmart a great defensive investment in retail.

But investors interested in investing in the faster growth of e-commerce companies should stick with Amazon, despite a strong quarter from Walmart.