Investors in Wal-Mart Stores (WMT -0.32%) must have been wondering what the world was coming to. In 2015, while the broader market ended the year just short of breakeven, the stock for the retailer was down a dismal 29%. For the fiscal year that ended January 31, 2016, revenue fell 0.7% year over year, while net income dropped 10% and same-store sales rose a pitiful 0.6%. This marked the first time the company had failed to increase its sales since the company went public in 1970. 

Results for the following year were only slightly better, with revenue up 0.8% year over year, while net income fell 7% and comparable same-store sales rose 1.8%. Competition from e-commerce juggernaut Amazon.com (AMZN -1.11%) weighed heavily on the retailer, and prognostications concerning the death of the American retailer were rampant.

A Wal-Mart employee assisting a customer with an in-store pickup.

Wal-Mart's stock was on fire in 2017, following impressive results. Image source: Wal-Mart.

Last year was another story, though. Investments the company made in the online sales arena, as well as a variety of shipping and in-store pickup initiatives, began to bear fruit and brought investors back from the sidelines. 2017 will be remembered as the year that Wal-Mart put Amazon on notice that it had its own e-commerce and omni-channel chops -- and that it was a force to be reckoned with.

A year of transformation and rebirth

The seeds for Wal-Mart's remarkable about-face were actually planted in August 2016 with the purchase of online retailer Jet.com for $3.3 billion. This was the first of several such acquisitions the company made in an effort to position Wal-Mart to compete in the rapidly growing area of e-commerce. Other purchases included outdoor retailer Moosejaw, men's clothing company Bonobos, and women's fashion clothier Modcloth.

The most important acquisition was that of Jet.com founder Marc Lore, who Wal-Mart appointed its head of e-commerce. Lore brought a start-up mentality to the company's efforts to revamp its online strategy.

Several initiatives highlight Wal-Mart's ongoing transformation into an omni-channel powerhouse. Wal-Mart and subsidiary Jet.com began offering free two-day shipping on orders of $35 or more -- emphasizing that "it's all available to you without joining a membership club or paying extra fees for the privilege," in a not-so-thinly veiled shot at Amazon.com. The company also acquired delivery service Parcel, which arranged same-day shipping for meal kits and online retailers in New York. Parcel's automated delivery platform will provide Wal-Mart with the technological foundation to expand its own shipping efforts. 

Wal-Mart piloted test projects that encouraged the stores' employees to drop packages to customers on the way home, and it brought in giant vending machines that allow customers to order online and pick up those items in the store for a discount.

Jet.com also introduced a new fun and edgy private-label brand called Uniquly J, targeting millennials with colorful packaging, irreverent copy, and bold designs to appeal to younger shoppers in a way that the company's legacy private-label brands -- Equate, Sam's Choice, and Great Value -- never did.

The proof is in the pudding

In its 2018 fiscal third quarter (which ended October 31, 2017), the company reported revenue that increased 4.2% year over year and comparable same-store-sales that jumped 2.7%. Excluding one-time items related to the hurricane and extinguishment of debt, profits exceeded those of the prior-year quarter. Even more importantly, the company's e-commerce sales jumped 50% over the prior-year quarter. 

The company is increasingly focused on its online and omni-channel capabilities. In late 2017, Wal-Mart Stores announced that it would be dropping both the hyphen and the "Stores" from its name, in a nod to the company's ongoing move into e-commerce. 

WMT Chart

WMT data by YCharts.

Wall Street is beginning to notice

Analysts at Citi Research issued a rare and laudable "mea culpa" regarding its previous call on Wal-Mart. In a note to clients, Kate McShane wrote (emphasis mine):

We sat on the sideline with this name in '17, which proved to be a big mistake. Despite the stock's run-up, we think there is even more to come...Our belief that its aggressive omni-channel strategy will continue to drive significant sales growth and Wal-Mart's e-commerce operations are emerging as a true challenger to Amazon, both factors that could fuel further multiple expansion. 

The most noticeable change for investors has been in the stock performance. After two disappointing years, Wal-Mart's stock was up an impressive 43% in 2017, more than double the broader market's 19% rise.

Look for the company to continue its winning ways as more of Wal-Mart's initiatives take hold and it pushes further into the realm of e-commerce. 2017 was a year to remember for Wal-Mart.

Editor's note: an earlier version of this article incorrectly said that Wal-Mart acquired Jet.com in 2015. The article has been updated.