Image source: The Motley Fool.

Wal-Mart (WMT 0.83%) stock is doing remarkably well lately; shares of the retail juggernaut have gained almost 20% year to date. Even better, the stock still has a lot to offer to investors, at least according to Barclays. The bank recently upgraded Wal-Mart from an "equal weight" to an "overweight" rating, increasing its price target for the stock from $70 to $87 per share. This implies an attractive upside potential of more than 20% versus current price levels.

Investors should always take Wall Street recommendations with a grain of salt; professional analysts can make mistakes just like everyone else, and they often do. However, there is nothing wrong with taking a look at Barclays' bullish thesis for Wal-Mart to find out whether it makes sense.

The tide is turning

The discount retail industry has always been notoriously challenging and competitive, and things are getting even more difficult for brick-and-mortar retailers due to asphyxiating competitive pressure from (AMZN -0.17%). The online retailer is focused on providing aggressively low prices and a high-quality experience to customers, even when these come at the expense of its own profitability. Competing against a company such as Amazon, which is willing to put market-share gains over profits, can be a daunting challenge, and this is having a negative impact on retailers across the board. 

But Wal-Mart is fighting back; the company is increasing its investments in people and technology to improve service quality and accelerate online growth. In addition, Wal-Mart has recently formed an alliance with Chinese e-commerce operator (JD -2.98%), and the company has invested $3.3 billion in the purchase of online retailer

According to Barclays, these initiatives are generating improving performance at Wal-Mart. As quoted by CNBC, the Barclays note to clients says: "We believe the tide is turning [for Wal-Mart]. Investments in labor appear to be resonating with the employees and therefore the customers, the quality of the product offering is improving, and service and execution has improved."

The company doesn't disclose its internal customer satisfaction figures, but management is talking about consistent improvements in customer satisfaction and service over the past several quarters. Specifically, CEO Doug McMillon said in the most recent conference call: "Our customer satisfaction scores have continued to strengthen and our in-stock has gotten better. Our associates are responding and I'm proud of them."

The company is making sound progress in key areas such as mobile payment technologies. Its digital payment app is now available in the more than 4,600 Wal-Mart stores nationwide. According to the company, four out of five customers would recommend using Walmart Pay, and 88% of transactions come from repeat Walmart Pay users. These numbers speak well of customer satisfaction scores in mobile payments.

While the company still has substantial room for improvement, revenue figures are pointing in the right direction. Global revenue excluding currency fluctuations grew 2.8% last quarter, and comparable sales in the U.S. exceeded the company's guidance, with a year-over-year increase of 1.6%. Wal-Mart has delivered positive comparable sales in the U.S. over the past eight consecutive quarters, while traffic has increased for seven quarters in a row.

About the price target

Wall Street analysts are estimating that Wal-Mart will make $4.34 in earnings per share over the current year. Of course, earnings forecasts are subject to errors and adjustments, and analysts have, in fact, increased their earnings estimates for Wal-Mart over the past several months. Just 90 days ago, Wall Street was expecting $4.26 in earnings per share from the company, so estimates are increasing as a reflection of positive business momentum.

Based on current earnings expectations, Wal-Mart stock is trading at a price-to-earnings ratio in the area of 16.5, while a price target of $87 per share would put the stock at a P/E of around 20. As a reference, the average company in the S&P 500 index is currently trading at a P/E in the neighborhood of 19.3.

Similarly, Wal-Mart pays a dividend of $0.50 quarterly per share; this represents a dividend yield of 2.8% at current prices. The $87 price target from Barclays would mean a dividend yield of 2.3%, which is the average dividend yield currently offered by companies in the S&P 500.

An $87 price target for Wal-Mart would mean a valuation roughly in line with the average stock in the S&P 500. The company operates in a difficult segment, and growth rates will probably remain below average over the medium term, so Wal-Mart needs to continue delivering improvements to justify an expansion in valuation ratios. However, as long as management keeps leading the company in the right direction, Barclays' price target for the company doesn't seem unreasonable at all.