A pair of behemoths in the retail space, both Amazon (AMZN -1.45%) and Walmart (WMT -1.22%) have been strong winners in 2024. However, it's Walmart's stock that has been the bigger winner this year, up nearly 80% year to date as of this writing compared to about a 47% return for Amazon's stock.

With the calendar soon set to flip over to 2025, let's see which stock looks best positioned to outperform next year.

Business transformations

There's no doubt that Amazon has had a major influence on Walmart over the years. Its online retail platform and logistics network created an existential challenge for Walmart that led the latter company to transform itself into the largest grocery store in the country. In fact, Walmart now accounts for more than a quarter of all grocery sales in the U.S.

Walmart's scale and buying power have enabled it to offer its customers the best prices. Given the high inflationary environment of the past few years, this has not only resonated with Walmart's core customer base, but it helped it draw in more affluent customers as well.

At the same time, Walmart continues to have a massive physical footprint, to the point where 90% of the U.S. population is within 10 miles of one of its stores. Combining ubiquity with increasing behind-the-scenes automation, the company has been able to offer free same-day delivery through its Walmart+ membership, further adding convenience and attracting customers. In some locations, it even offers in-home deliveries.

All of this also helps power growth for its general merchandise categories. Last quarter, while some other general-merchandise retailers such as Target were struggling, Walmart noted strength in categories such as in-home tech, toys, and seasonal decor.

The company has also leaned into digital advertising with its Walmart Connect ad business, which offers both online and offline marketing solutions for brands. Last quarter, it said advertising and memberships helped account for half of the operating income gains it saw.

Overall, Walmart grew revenue by 5.5% last quarter, operating income by 8%, and adjusted earnings per share (EPS) by 14%.

A person reaches for a snack on a store shelf.

Image source: Getty Images.

That said, Walmart's success has not hampered Amazon's retail growth. The online retail giant saw a 9% increase in revenue in its North American retail segment last quarter, and a 33% jump in North American operating income. Like Walmart, Amazon is seeing strong digital ad growth, which was up 19%, helped by its sponsored-ad business.

It's also in the grocery business, with Amazon Fresh and Whole Foods, though they aren't as important to Amazon as grocery sales are to Walmart. Meanwhile, Amazon appears primed to take advantage of industry struggles and go after the pharmacy business, as it's started offering same-day pharmacy services in several major cities.

Amazon has transformed its business over the years as well and is now much more than just an online retailer. It owns a popular streaming service in Prime Video, but the company's biggest profit driver is its AWS cloud computing business. This segment grew its revenue by 19% last quarter, while its operating income soared 49% to $10.4 billion. This compares to operating income of $5.7 billion for the North American retail segment and $1.3 billion for the international retail segment.

Not surprisingly, Amazon is turning toward artificial intelligence (AI) to help drive revenue growth and improve profitability. In cloud computing, it's helping customers create their own AI applications through its SageMaker platform, while offering foundational large language models (LLMs) from both itself and AI start-ups with its Bedrock platform. It's also looking to save logistic costs by using AI to find the best routes. And it's using AI to make it easier for third-party sellers to list items on its site, and to help with better product information and recommendations.

Valuation and verdict

The traditional gap in valuation between Amazon and Walmart has closed substantially this year. Amazon now trades at a forward price-to-earnings (P/E) ratio of 36, while Walmart currently sits at a multiple of 34:

AMZN PE Ratio (Forward 1y) Chart

AMZN PE Ratio (Forward 1y) data by YCharts.

Amazon recently has been growing revenue more quickly than Walmart (11% last quarter versus 5.5%), although it's spending heavily on capital expenditures as it chases its AI opportunity.

Both companies have shown the ability to adapt and innovate over the years, which should lead both their stocks to be long-term winners. However, for 2025 -- given the modest valuation gap between the two, its higher revenue growth, and the AI opportunity in front of it -- I prefer Amazon.