The year was 2015. Walmart (WMT 0.62%) CEO Doug McMillon had been at the helm of the retail giant for less than two years, but he was facing a slow-moving disaster. Growth was stagnant as the company was steadily losing market share to e-commerce juggernaut Amazon and more nimble brick-and-mortar retailers like Costco.

With online retail going mainstream, Walmart's tried-and-true "land-grab" strategy of blanketing the U.S. with superstores was no longer delivering the growth the consumer staples giant was accustomed to. The lack of future growth was evident in the stock price, which had gone almost nowhere over the previous 15 years and had sagged through much of 2015 on disappointing results.

Walmart CEO Doug McMillon standing with a crowd of coworkers.

Image source: Walmart.

To breathe new life into Walmart, McMillon made a surprising move in February 2015. He said that Walmart would raise its minimum wage from the federal minimum of $7.25/hour to $9/hour that April, and then up to $10/hour by the following February (2016).

In October of that year, at the company's annual Investor Day conference, McMillon said that earnings per share would decline 6%-12% the following year (fiscal 2017), as the company implemented the next leg of the wage hike and invested in training, e-commerce and store improvements. The company envisioned a return to EPS growth of 5%-10% by fiscal 2019.

Wall Street did not take the news well, especially the forecasted decline in earnings. Walmart shares plunged 10% following the Oct. 14 announcement, on extremely high trading volume. Shares continued to slide over the following weeks as analysts and fund managers dumped the stock, no longer confident that it could generate profit growth.

However, that announcement turned out to be an inflection point in the stock. Take a look at how Walmart performed in the 15 years before the move, compared to the five years since.

WMT Chart

WMT data by YCharts

Dating back to the start of the century, Walmart shares were actually down through October 2015, as the chart above shows. But that changed quickly after the sell-off driven by the wage hike. 

WMT Chart

WMT data by YCharts

As you can see, Walmart has nearly doubled the performance of the S&P 500 since then, a remarkable turnaround for a stock that had generated middling returns for so long.

The takeaways

Of course, Walmart's wage hike isn't the only reason the stock has done so well over the last five years. The company has overhauled its strategy. It essentially stopped opening stores in the U.S., instead investing in grocery pickup stations, its e-commerce marketplace, and delivery infrastructure, which now includes same-day delivery through Walmart+. Its 2016 acquisition of Jet.com gave it a big thrust into e-commerce, accelerating the transition. Outside of the U.S., the company has shifted its focus to growth markets like India where it acquired a majority stake in Flipkart, and also took a 5% piece of JD.com, China's biggest direct online retailer and fastest growing e-commerce company. And the company has gotten a significant tailwind from the pandemic this year, which has helped drive sales and profits higher. Still, it's worth focusing on the moment back in 2015 when the stock turned around, as it's rare for such a large company to experience an inflection point like that. 

There a number of conclusions investors can draw from the charts and story above. One may be not to discount the potential of an industry leader like Walmart, nor the impact of a new CEO such as McMillon. However, the biggest lesson here seems to be that it can pay off for a company to make short-term sacrifices for long-term growth and that investors can capitalize on such opportunities.

Wall Street, which tends to be nearsighted, was skeptical of the strategy from the beginning. The first chart shows that the stock began to fall almost as soon as the company said it planned to raise wages in 2015. Raising wages, in and of itself, turned about to be a smart move because it helped the company reduce turnover, clean up its stores, reduce stockouts, and improve customer satisfaction. It's also been a big reason why Walmart has now posted 25 consecutive quarters of comparable sales growth in its U.S. stores, a streak dating back to 2014.

It also reflected a change in the philosophy of Walmart. The company showed it was willing to invest for the long term, and not seeking to be as frugal as possible with every decision, which had been a traditional part of its culture. Amazon's rapid growth showed that price savings alone were no longer enough to drive traffic to Walmart's stores, and the retailer has successfully adapted to changing industry dynamics. 

Investors should keep an eye out for such sell-offs in the future. One of the best gifts from Wall Street is a stock plunging on news that a long-term investment will have short-term costs.