Wal-Mart Had an Incredible 2017

We won't know exactly how Wal-Mart (NYSE: WMT) fared during the holidays until February, but the retailer will likely put up solid numbers if the first nine months of 2017 are any indication. Wal-Mart had an outstanding 2017 on pretty much every front. The stock soared 42%, handily beating the broader market. The company's thousands of stores produced consistent sales growth, and the online business exploded.

A bet that paid off

Shares of Wal-Mart crashed in 2015, losing 28% of their value. Part of the reason was the company's plan to raise wages and invest in its employees. CEO Doug McMillon announced the plan in February 2015. It featured a higher starting wage, improved training programs, better benefits, and more flexible scheduling.

Concerns that these changes would knock down earnings took a toll on the stock price. Those fears weren't misplaced -- Wal-Mart reported earnings declines in both 2015 and 2016. But the long-term benefits outweigh the short-term downside. Wal-Mart has reported comparable sales growth in the U.S. for 13 consecutive quarters, despite a retail environment that's testing many of its peers. Wal-Mart had no trouble driving traffic to its stores in 2017.

Profits are still being pressured by the company's investment in its stores, as well as its e-commerce initiatives. But it's clear that Wal-Mart's strategy is working.

An e-commerce monster

Wal-Mart paid $3 billion for e-commerce start-up Jet.com in late 2016. Jet.com CEO Marc Lore was put in charge of Wal-Mart's entire e-commerce operation. It was an expensive acquisition, but it jump-started the company's e-commerce efforts at a time when it absolutely needed to catch up to Amazon.

The results of this acquisition and Wal-Mart's other e-commerce initiatives speak for themselves.

Organic growth through Walmart.com drove much of these sales gains. The company has vastly expanded its assortment of products, launched free two-day shipping on orders over $35, and introduced pick-up discounts on certain items. It also plans to bring Jet.com's "Smart Cart" feature to Walmart.com sometime this year, providing another way for customers to save money.

Beyond standard e-commerce, Wal-Mart's online grocery service is another driver of this growth. The free service is available at more than 1,000 locations as of September, and the company is testing out online grocery delivery in a handful of markets. Other supermarket chains, including Kroger, offer similar services. But Wal-Mart has been aggressive as it defends its grocery market share and attempts to win even more.

Not a cheap stock

That 42% gain in 2017 has made Wal-Mart stock a lot less attractive, despite the fact that nearly everything seems to be going right for the company. Wal-Mart expects to produce adjusted earnings of as much as $4.46 per share in fiscal 2018, which ends this month. That puts the price-to-earnings ratio at a lofty 22.

To be fair, earnings are still depressed from the investments that Wal-Mart is making. But the intensity of those investments, especially in e-commerce, probably isn't going to let up anytime soon. Wal-Mart is aiming to be a meaningful alternative to Amazon, a company that operates with razor-thin or nonexistent margins. Going after the market leader won't be cheap.

That's not to say that Wal-Mart won't be a solid investment. I just don't think we'll see a repeat of 2017 this year. Earnings need to catch up with the stock price, and it's hard to say what kind of growth rate Wal-Mart can achieve as it goes head-to-head with Amazon.

10 stocks we like better than Wal-Mart StoresWhen investing geniuses David and Tom Gardner have a stock tip, it can pay to listen. After all, the newsletter they have run for over a decade, Motley Fool Stock Advisor, has tripled the market.*

David and Tom just revealed what they believe are the 10 best stocks for investors to buy right now... and Wal-Mart Stores wasn't one of them! That's right -- they think these 10 stocks are even better buys.

Click here to learn about these picks!

*Stock Advisor returns as of January 2, 2018

John Mackey, CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool's board of directors. Timothy Green has no position in any of the stocks mentioned. The Motley Fool owns shares of and recommends Amazon. The Motley Fool has a disclosure policy.