Attention, Wal-Mart investors: You'd better saddle up for a bumpy ride.
Shares of the world's largest retailer extended their year-to-date losses when they fell 3 percent on Tuesday, after the company reported weaker-than-expected second-quarter earnings and slashed its full-year outlook.
This marked the second straight quarter when Wal-Mart's profit fell short of expectations, as the cost of paying higher wages to its associates, investments in its online and in-store businesses, theft and the spoiling of fresh foods contributed to another decline in operating income—its sixth in the last seven quarters, according to Retail Metrics.
For patient investors, however, the quarter signaled a further improvement in Wal-Mart's domestic operations, including its best same-store sales result in three years, and a third consecutive quarter of higher traffic.
These improvements attest that the company's investments are already bearing fruit, and should drive profit higher in the long-term.
"When you're doing the things that Wal-Mart is doing, you're going to see some choppy earnings," said Moody's analyst Charles O'Shea. "This isn't a short-term story by any stretch of the imagination."
Walmart U.S. CEO Greg Foran openly admitted to investors that the aforementioned costs, along with lower-than-expected reimbursements in its pharmacy business, "will present continuing profit challenges for the remainder of the year."
Following the company's decision to raise wages for its store employees to a minimum $9 an hour—a change that took place in April—Wal-Mart said pay increases, training costs and additional store hours will decrease its earnings per share by 24 cents this year. This impact will continue to be felt next year, when the retailer will boost employee pay to $10 an hour for many workers.
The company also quantified a hit of 6 to 9 cents a share this year to improve its Web operations. Although these investments will cause short-term pain for the stock, they're critical to the long-term health of the retailer—something investors are already starting to see come through in its results.
For example, as Foran has placed a greater emphasis on keeping more registers open during peak shopping hours, better-maintaining its stores and ensuring shelves are well-stocked, traffic at its U.S. stores rose 1.3 percent during the quarter. Similarly, same-store sales grew 1.5 percent.
The outperformance of its small-format Neighborhood Market stores has likewise continued, with comparable sales at these locations rising 7.3 percent during the quarter.
Though Wal-Mart will now open 160 to 170 of these stores this year—down from original projections for between 180 to 200—O'Shea said he continues to view these locations as a "game changer" that will help it steal quick midweek shopping trips from its competitors.
Wal-Mart also reported stronger sales in apparel and consumer electronics. While O'Shea attributed some of this boost to back-to-school purchases, he said the retailer's focus on improving its merchandise also played a role.
The fact that gas prices have remained low and employment trends are improving also weighed in the company's favor.
"Some of [Wal-Mart's sales growth comes] down to the continued impact of lower gas prices," said Neil Saunders, CEO of Conlumino retail research. "However, some of it is also down to improvements the company has made to its general merchandise offer, for which it deserves credit."
Outside of Wal-Mart's investments, headwinds related to its pharmacy business and "shrink"—a term that includes lost revenue from food that can't be sold because it's passed its expiration date, as well as theft—are expected to cost the retailer another 11 cents a share this year. But O'Shea said he views the issues surrounding shrink as short-term.
Wal-Mart is already working to combat shrink-related losses by cracking down on theft and reducing the price of items nearing their expiration date. At a meeting with analysts in April, Foran estimated that the markdown initiative will save $500 million a year.
During a period of such heavy investment and change, analysts said the key to gauging Wal-Mart's success is to understand that its earnings will be choppy. To better assess the retailer's health, O'Shea said investors should look to results in the company's core business and online execution, both of which are gaining traction.
Raymond James analyst Budd Bugatch sounded a similar note, telling CNBC that if Wal-Mart wins with consumers it will win with shareholders, as "earnings will ultimately follow."
"Compared to expectations, which is what we all look at in the very short term, [Wal-Mart's earnings were] a disappointment," he told CNBC's "Squawk Box."
"That's where the opportunity lays for investors who are willing to be a little bit patient."
Bugatch has a "strong buy" rating and an $86 price target on the retailer.
So far this year Wal-Mart shares are down 19 percent, near $70.