A Wal-Mart truck.

Image source: Wal-Mart.

What happened

Shares of retail behemoth Wal-Mart Stores (WMT 0.22%) jumped 12.75% in 2016, according to data provided by S&P Global Market Intelligence. There was no single piece of news that drove the gains, which all occurred in the first seven months of the year. Instead, steady comparable-sales growth in the United States and new online initiatives likely drove investors to buy the stock.

So what

Wal-Mart followed through on its plan to raise wages and improve training in February. The moves knocked down Wal-Mart's profit, but the company expects improved efficiency, employee morale, and customer satisfaction to eventually reverse that trend.

The focus on making its U.S. stores more appealing to shoppers paid off in 2016. The third quarter marked the ninth consecutive quarter of comparable-sales growth, with much of the growth driven by increased store traffic. Earnings declined as expected, but investors focused on the solid U.S. results.

Wal-Mart's e-commerce business also gained momentum during 2016. Global e-commerce sales rose by just 7% year over year, adjusted for currency during the first quarter, but accelerated to 20.6% growth during the third quarter. Wal-Mart's push into online grocery, allowing its customers to order online and pick up for free at its stores, has helped drive this growth. Wal-Mart also acquired Jet.com in August, but the stock declined from that point on.

Now what

Shares of Wal-Mart have continued to decline in 2017, as many retailers that have reported results so far have disappointed investors. Wal-Mart stock has slumped about 3.5% year to date, wiping out a portion of last year's gains.

Wal-Mart will need to remain aggressive as it grows its e-commerce business to compete with Amazon.com. The acquisition of Jet.com gives the company a brand that should appeal to those wary of shopping at Wal-Mart, and initiatives like the Pickup and Fuel concept stores could help the company maintain and grow its grocery market share.

Wal-Mart will report its fourth-quarter results on Feb. 21, with investors expecting continued U.S. comparable-sales growth and double-digit e-commerce gains. If Wal-Mart disappoints like other retailers have, even more of 2016's gains could be erased.