Over the last five years, shares of Wal-Mart (WMT 1.32%) are up around 60%, a return nearly half that of the S&P 500. This comes as the company is finding it hard to grow. With a nearly $250 billion market cap, it's easy to see why finding new markets or undergoing massive cost cuts could be difficult.

Over those last five years, Wal-Mart has managed 3.3% annualized revenue growth. Compare that to the near 11% annualized growth that one of Wal-Mart's biggest competitors, Dollar General (DG 0.30%), has managed over the same time period. However, for long-term investors, Wal-Mart could still be a worthwhile investment.

Wal-Mart's big overhang
It appears that the retailer's biggest problem is generating enough sales to move the growth needle. For example, Wal-Mart has noted that it's a big feat to generate $5 billion in incremental sales just to show 1% sales growth. As a result, Wal-Mart is turning to e-commerce to help expand its reach. Its e-commerce revenue grew 30% in fiscal 2014 to $10 billion, while the entire company brought in $473 billion. On the flip side, Wal-Mart might also turn to 3-D printing in an effort to better meet customer needs. It could use the technology in its stores to keep items in stock, and also print custom items.

Luckily for Wal-Mart, its chief competitor Target is also struggling. Target has been facing slightly different issues, however. Target mainly operates as a North American retailer, unlike Wal-Mart with its worldwide presence, and Target's recent entry into the Canadian market did not go as planned. The company tried a nationwide roll-out and ended up stretching its distribution network too thin, which left many stores short of inventory. That seems like a fixable problem for Target. 

Even still, Morgan Stanley has come out and backed Wal-Mart. The investment firm has put an $87 price target on the company. That's about 13% higher than where Wal-Mart currently trades. The firm said that the retail giant is one of the best low-risk plays on the rebound in low-end consumer spending. It also noted that Wal-Mart has vast omni-channel capabilities. On the flip-side, Morgan Stanley slapped Target with an underweight rating last month. The firm put a $60 price target on the stock, which is right around where it currently trades.

Dollar store competition
Massive retailers are facing competition from the robust growth of dollar stores. The majority of these companies are much more nimble than larger retailers. The leading dollar store operator, Dollar General, has a store base over double that of Wal-Mart in the US. However, Dollar General has no plans to stop growing.

Given its smaller store base and ability to excel in rural markets, Dollar General plans to open a total of 700 stores in 2014, while Wal-Mart plans to open 115 supercenters and 120 smaller format stores. Granted, Wal-Mart has taken a direct shot at dollar stores with its push to open smaller stores, but it still has a lot of catching up to do as Wal-Mart only has a few hundred small format stores open.

It would seem that Dollar General's consumables and tobacco offerings are still bringing traffic into its stores. Its comparable-store sales continue to grow nicely; 2013 was the 24th straight year of comparable-store sales growth for the retailer. What's more is that it's looking to add wine and beer to its stores to continue this string of comp-store sales growth.

How the shares stack up
Wal-Mart does have the lowest P/E ratio of the three stocks at 16. Target trades at a P/E ratio of 20.3 and Dollar General trades at 17.9. Target pays a 3.5% dividend yield, while Wal-Mart yields 2.5%. Wal-Mart has managed to increase its dividend every year for the last 38 years. And when you look out over the last 38 years, Wal-Mart's total return (stock price appreciation and dividends) is 732%, while the S&P 500 provided a total return of only 543%.

Bottom line
Wal-Mart has underperformed the S&P 500 for the last half decade, but it's still a dividend-paying machine. Over the long term, it's proven it can beat the S&P 500 handily. It's also tapping into the vast e-commerce market for future growth. For long-term investors who can look past the interim noise, Wal-Mart is worth a closer look.