Image source: Wal-Mart

The first quarter of 2016 was absolutely merciless to a lot of retailers. So when Wal-Mart (NYSE:WMT) reported earnings on May 19 that weren't downright awful, investors cheered and piled into its shares, sending the stock price up nearly 10%. Despite the bullish trading, there was one number that stuck out like a sore thumb in the earnings report: Wal-Mart's online sales grew just 7% year-over-year.

In fact, last quarter marked Wal-Mart's ninth consecutive quarter of decelerating e-commerce sales growth. Additionally, the company underperformed the broader industry, which saw e-commerce increase over 15% year-over-year to account for nearly 8% of all retail sales. And while Wal-Mart is working off a larger sales base than most of its online competitors, the leading name in e-commerce, (NASDAQ:AMZN), saw its retail sales increase 27% in North America and 24% internationally during the first quarter as the company continues to gobble up online market share.

Management knows it needs to do better

Wal-Mart's management was unimpressed with the e-commerce results as well. During the earnings call, CEO Doug McMillan noted:

Growth here is too slow. The U.S. number is better than the global number, but neither is as high as we'd like. We can see progress against several of the necessary capabilities we need to win in e-commerce, but we're still working on a few others. We need them all to come together to see stronger growth.

Over the past few years, Wal-Mart has invested billions in technology and new fulfillment centers in order to compete with online retailers. Its latest push was a newly opened fulfillment center in California -- the fifth state to serve as a home for these online operations. The company is also able to leverage more than 80 of its retail locations to ship items directly from stores.

However, the payoff of those investments has declined. Wal-Mart's return on invested capital has fallen about 180 basis points since the beginning of 2013, when the company started redoubling its efforts in e-commerce.

WMT Return on Invested Capital (TTM) Chart

Combined with an increase in worker wages and the money it's spending to open new stores, Wal-Mart has seen a similar decline in operating income and earnings per share. The revenue growth from e-commerce just isn't enough to overcome the increased investment in the platform. As McMillan put it, "Growth here is too slow."

Wal-Mart's latest effort is already under attack

The biggest opportunity for Wal-Mart in online sales is groceries. More than half of Wal-Mart's revenue comes from this category, which helped shield the company from the declines other retailers experienced during the first quarter. However, groceries have also been slow to move online.

Wal-Mart is at a huge advantage compared with most smaller operations to win an outsized share of online grocery sales due to its existing e-commerce infrastructure. The company has rolled out online order and pickup, which allows customers to pick up their purchases in the store parking lot, and the offering has had a strong start. The service will operate in nearly 40 markets by the end of the month.

But once again, Amazon is also working hard to take share in the online grocery market. The Prime Now service can deliver consumer staples in less than hour in its current markets. The company reportedly launched new private-label brands for grocery items, and it partnered with Sprouts Farmers Markets in California to run its online order/home delivery business, which portends the opportunity for Amazon to help local grocers compete against Wal-Mart and its deep pockets.

Wal-Mart should be able to make some inroads with online ordering, but Amazon represents a constant threat to both Wal-Mart and smaller grocery stores. This is the one area where Wal-Mart has a significant advantage over the competition as it fights for more digital revenue, so it needs to expand quickly before losing momentum.