By most accounts it was a solid fourth quarter for the word's largest retailer. Same-store sales in the U.S. grew 8.6%, driving companywide revenue of $152.1 billion. That's 7.3% better than the year-ago top line, topping estimates of $148.3 billion. E-commerce sales continued their double-digit march, improving another 69%. Per-share operating earnings of $1.39 missed the consensus $1.51, but operating income was still up 3.1%, and we know exactly why the bottom line fell short -- COVID-related costs.

Yet, Walmart (WMT -1.75%) shares are down nearly 11% since it reported its Q4 results. Investors are concerned by the earnings miss, though seemingly downright annoyed by the retailer's capital expenditure plans for the year now under way.

A standing crowd of people talking to one another.

Image source: Getty Images.

It's understandable. The company says it's going to invest $14 billion in areas like automation and its supply chain. All told, this year's capital spending will be about 50% more than it's been shelling out of late. Then there's the big pay increase for more than 400,000 workers in the works. Without offering specifics about its growing costs, Walmart is now only looking for slight growth in U.S. operating income this year, while calling for slight declines in sales and per-share profits.

And there's the rub. Investors understand a company has to spend money to make money. It's not always clear, however, that a short-term investment makes enough long-term sense.

Big spending on tap

The stock's steep sell-off makes it clear where investors stand, although for the record, not even the analyst community is quite sure what to make of it. Morgan Stanley analyst Simeon Gutman describes the capital deployment plans as "prudent initiatives," yet acknowledges this year's results will be "hampered." Gutman fears shares of the stock could simply "tread water" in the near term as the news and numbers are digested.

The analyst community seems to agree on one thing, though. That is, while spending will crimp profits this year, the spending should be worth it. No analyst downgraded the stock in response to the news despite an opportunity to do so. Goldman Sachs is still on board with its bullish thesis too, while Raymond James analyst Bobby Griffin notes that "we continue to see Walmart as a long-term winner in today's retail environment."

The catch? This really is all long-term optimism, looking at the benefit of this year's expenditures into 2022 and beyond.

That's the appropriate viewpoint even if the market's forgotten it for the time being. And it's particularly appropriate given that such an investment has a shot at finally getting Walmart's e-commerce operation out of the red and into the black.

While the pandemic allowed the retailer to win new market share (especially on the grocery front) by leveraging its physical footprint and existing curbside pickup offering, it's not been cheap. Online orders, for instance, are not only brought to customers' cars by employees but picked off store shelves by people too; new hires were needed to work those stations. As much as revenue grew last year, Walmart's operating, selling, and administrative expenses grew just a little more. More automation like the company's order-picking "Alphabots" may well cull some of these recently increased costs linked to a bigger employee base.

CEO Doug McMillon also didn't provide any specific plans during the Q4 earnings call when talking about investments in the company's supply chain, but it's clear he's envisioning Walmart's stores and warehouses as being cross-cable at the customer and product level. In his words:

"...think of our U.S. supply chain with hundreds of distribution and fulfillment centers, thousands of stores and clubs so close to so many people functioning in a hybrid fashion, automated where they should be based on volumes and complemented with onsite market fulfillment centers or offsite MFCs where we see incremental demand. Importantly, imagine our supply chain is interconnected so the cost to meet or exceed customer expectations is optimized."

In other words, the pandemic may have given the company the scale it wanted where it wanted it. It was forced to meet the surge demand, however, without really having all the right cost-curbing measures in place.

McMillon goes on to explain: "We're going to invest more aggressively in capacity and automation to position ourselves to earn the primary destination with customers."

With the echoes of COVID-19 still ringing while the opportunity to secure market share is still in place, the company's got a great shot at doing just that.

Think longer-term

The knee-jerk response from investors is understandable. Earnings growth seemed to come so easily for Walmart under McMillon's leadership, and the retailer excelled in 2020's challenging circumstances. Now the proverbial bill for that growth is coming due. The market's suffering from sticker shock.

Don't misread this sizable setback as anything more than a short-term surprise, though. Walmart should be putting more money to work now to drive in more profit growth later...which analysts decidedly expect with next year's projected earnings growth of 9%. The sell-off since the company's fourth-quarter numbers and current-year outlook were released is ultimately a buying opportunity.