The year 2014 tested the patience of Wal-Mart (NYSE:WMT) investors as the company struggled with rising competition, falling comps, and a food scandal in China -- but the retailer proved its worth eventually.

Wal-Mart reported positive U.S. comparable-store sales in the third quarter, after a wait of seven quarters, and expects to end fiscal year in January on a more balanced note. Investors are slowly warming up to its new strategies, and at just above $90 as of Jan. 8, the stock was trading at its 52-week high. Let's take a look at the points that bent Wal-Mart in the last 12 months, and those that kept it floating.

A Wal-Mart store displaying television sets. 

The six-quarter-long nightmare...
The Arkansas-based retailer has reported negative U.S. comps growth in five of the last seven quarters. Even before that, comps had been deteriorating, likely resulting from stiff competition from dollar stores that are lowering prices, government's food stamp cuts, and severe weather, among others.

It's no secret that the food-stamp program is a big revenue generator for the company. The cut enacted by the government in November 2013 hit Wal-Mart's sales, especially grocery, which makes up more than 50% of its top line.


Wal-Mart U.S. comps growth in the past 11 quarters. Chart data source: Wal-Mart Quarterly Releases.

The operating income of Wal-Mart U.S. and Sam's Club has also experienced pressure. From February to October, Wal-Mart U.S.'s operating income declined 2.6% in spite of a sales growth of 2.7%. This is not surprising considering the company has had to lower prices to ward off competition from dollar stores and devise cash reward programs to spruce up Sam's Club sales.

Wal-Mart pulled back its fiscal year earnings guidance from $4.90-$5.15 to $4.92-$5.02 at the end of the third quarter. The company cited high health care costs and investments in e-commerce and Sam's Club drove changes to the guidance.

Outside the U.S., a food scandal plagued Wal-Mart's China -- the retailer's "Five Spice" donkey meat was proved to contain fox DNA. The incident left a bad taste in consumers' mouths and sales started dropping. The scandal, combined with a slowdown in the Chinese economy, pulled comps into the red zone in the second quarter, and was Wal-Mart's only market in the period to report negative comps. To control the damage, Wal-Mart increased its spending twofold on food safety in the country from the initial $16 million to $48.2 million. 

...came to an end
The retailer's efforts to recover resulted in improved numbers in the quarter ended October 2014, mostly due to Wal-Mart's narrow-format stores and e-commerce.

Wal-Mart has posted some strong Neighborhood Market comps in the fiscal year, suggesting its strategy against the increasing encroachment of smaller dollar stores is working. By the third quarter, this strategy improved U.S. comps 0.5% over the prior year period. The retailer plans to open 200 narrow-format stores during the current fiscal year.

Source: Wal-Mart.

On the e-commerce front, Wal-Mart witnessed strong growth trends in most of its important markets such as the U.S., U.K., Brazil, Mexico, and China.

Source: Wal-Mart.

Notably, Brazil's online sales in the third quarter grew by more than 40%, and Mexico's online sales grew 60%. The retailer also broadened its online offerings in Mexico and China and added hundreds of collection points for online shoppers in the U.K. and China.  In the U.S., e-commerce constituted 0.2% of the 0.5% comps growth in the third quarter. E-commerce currently accounts for only 2% of Wal-Mart's total revenue, but these growth numbers suggest e-commerce will be a formidable force in future quarters. 

Wal-Mart's extensive investments in e-commerce and its smaller stores are helping to offset the stalling growth among its big-format stores. Ultimately, these investments set Wal-Mart in the right direction as the company adjusts to consumer needs and the new competitive landscape. Indeed, this is good news and will probably add long-term value to patient investors who have weathered the storm.