Wal-Mart (NYSE:WMT) has struggled with weak sales and earnings growth in recent years as consumers became less inclined to endure the hassle of shopping at big-box stores. Its sales trend has finally started to improve in the past year or so, but profit has taken another turn for the worse, as Wal-Mart has significantly increased the pay of front-line workers.

Sales growth isn't driving earnings growth at Wal-Mart -- yet. Photo: The Motley Fool

In Q3, Wal-Mart continued its steady turnaround progress. Earnings per share declined again due to expense growth in the U.S. and the strong dollar's impact on international sales. However, as long as the company can continue to post steady sales growth, its profitability should eventually recover.

Solid sales growth continues
Comparable store sales for the Walmart U.S. division continued to grow at a solid, if not spectacular rate last quarter. The 1.5% comp increase was driven by a 1.7% increase in traffic, offset by a slight decline in the average amount spent per transaction.

This was the fifth consecutive quarter of comp sales growth for Walmart U.S. That's a particularly important milestone, because it means the company is now delivering sales growth on top of sales growth, rather than just rebounding from sales declines in the year-earlier period.

Walmart's domestic sales growth indicates that its initiatives to invest in better store staffing to boost customer satisfaction are working. (70% of Walmart U.S. stores have hit their goal for customer experience scores so far.)

Sales momentum is accelerating at Target, too. Photo: The Motley Fool

It may also indicate that consumers are starting to return to big-box stores. Target (NYSE:TGT) posted solid comp sales growth last quarter, too. Target's Q3 comps rose 1.9% year over year, with most of the increase driven by traffic. Like Walmart, Target's sales momentum is accelerating.

Another growth driver is Walmart's investment in smaller stores. Comp sales for its "traditional" Neighborhood Market stores -- which average a little less than 40,000 square feet -- rose 8% year over year in Q3. The company is opening 160-170 of these stores this year and plans to add another 85-95 next year.

Cost increases drive down earnings
Despite Wal-Mart's continued sales growth, EPS declined about 10% year over year in Q3 to $1.03. For the full year, the company projects that adjusted EPS will decline to $4.50-$4.65 from $4.99 a year earlier.

Most of this decline can be traced directly to the company's decision earlier this year to increase employee pay and store staffing. Wal-Mart has estimated the total impact of these moves in the current 2016 fiscal year at $1.2 billion. It is increasing employee pay again in February, adding another $1.5 billion in annualized costs. As a result, EPS will likely fall again in fiscal year 2017 to around $4.00-$4.30.

Profitability trends thus make Wal-Mart look a lot worse than Target, where adjusted EPS from continuing operations is up 16.9% year to date. Including Target's discontinued Canada operations -- which were a huge money-pit last year -- the cheap-chic retailer has nearly doubled its EPS through the first nine months of the year.

This sharp divergence in earnings trends has allowed Target shares to post a roughly flat performance over the past year while Wal-Mart stock has plunged 29%.

WMT Chart

Wal-Mart vs. Target Stock Performance, data by YCharts

But Wal-Mart is on the right track
Wal-Mart's dreadful stock performance this year indicates that most investors are paying more attention to the company's falling earnings than its improving sales trend. Generally speaking, that's the right way to judge a company's performance.

However, there are some unusual factors causing Wal-Mart's current earnings slump. Wage investments and the strong dollar will have a combined pre-tax earnings impact of nearly $2 billion this year and at least $1.5 billion next year, depending on whether the dollar continues strengthening.

These earnings headwinds should disappear in about two years. Yet the impact of having longer-tenured, more-engaged employees should continue to promote sales growth for the foreseeable future. This sales growth will gradually offset the added costs from paying higher wages.

As a result, Wal-Mart is likely to return to strong EPS growth by the end of the decade. Its stock still trades for less than 15 times forward earnings, though. If Wal-Mart can maintain its steady sales growth and rebuild its profit margin in the next five years or so, the stock should rebound, too.

Adam Levine-Weinberg has no position in any stocks mentioned. The Motley Fool has no position in any of the stocks mentioned. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.