Wal-Mart Stores (NYSE:WMT) is the retailer everyone loves to hate. The stock is down approximately 12% year to date, and investors got another dose of bad news recently when Wal-Mart missed first-quarter earnings estimates.

Heading into the quarterly release, it seemed Wal-Mart had the wind at its back thanks to an improving economy and low gas prices. Theoretically, these should have boosted Wal-Mart's performance, but that wasn't the case.

Still, it might be premature to write off the world's largest retailer. Here's why Wal-Mart stock could be a Foolish opportunity in the making.

First, the bad news
Wal-Mart reported $1.03 in earnings per share last quarter. This represented a 7% year-over-year decline, and missed the analyst consensus estimate by $0.02, according to Bloomberg. Total revenue clocked in at $114.8 billion, down 0.1% year over year. The primary culprits behind the earnings decline were the stronger U.S. dollar and increased spending associated with higher employee wages and investments in e-commerce and worker training.

The currency effect is indeed a difficult challenge. Wal-Mart derives approximately one-quarter of its total sales from foreign markets. The strengthening U.S. dollar is now forecast to reduce sales by $14 billion this year, up from prior expectations of $10 billion.

But currency isn't the only challenge facing Wal-Mart. Another factor to watch is rising wages. Wal-Mart employs approximately 2.2 million people across the globe, and it is the largest private employer in the United States. The increasing public and regulatory pressure to raise the minimum wage in the U.S. is a headwind for Wal-Mart. The company is spending $1 billion to lift the minimum starting wage for all hourly associates to $9 per hour this year. This spending, at least in the short term, could pressure earnings per share.

Now, the good news

Source: Company website.

On the plus side, Wal-Mart continues to see strong results in its small-store format. Last quarter, Wal-Mart's "traditional" Neighborhood Market stores -- which are about 42,000 square feet on average -- posted 7.9% growth in comparable-store sales, a measure that analyzes sales at retail locations open at least one year. The Neighborhood Market banner was much stronger than Wal-Mart's overall U.S. operations, which grew same-store sales by just 1.1%.

Wal-Mart is aggressively expanding its small-store format. The company opened 24 Neighborhood Market stores last quarter, representing the majority of its U.S. store growth. This makes sense, as the smaller stores give Wal-Mart lucrative entry into large cities and urban areas, which simply couldn't offer the square footage necessary to build a Supercenter. It would be a huge mistake to miss out on millions of urban customers.

The other piece of good news is Wal-Mart's growing online business. E-commerce sales jumped 17% globally last quarter. There's plenty of room for continued growth here as well, since Wal-Mart operates e-commerce sites in just 11 countries across the globe. To keep increasing these sales, Wal-Mart is investing in its online capabilities. In the U.S., the company is rolling out a simplified checkout process on walmart.com. The goal is to deliver a better experience on mobile devices, an increasingly significant driver of its e-commerce business.

To build out its e-commerce business further, Wal-Mart recently announced a new fulfillment center in Brazil, which will be dedicated solely to e-commerce. Furthermore, Wal-Mart will open two new mechanized fulfillment centers in the U.S. this quarter, with two more to follow later this year. The company is also rolling out a $50-a-year shipping program that will compete with Amazon.com's Prime service.

Don't count out Wal-Mart
Fortunately for Wal-Mart shareholders, the news isn't all bad. Wal-Mart is still solidly profitable and pays investors a nifty 2.5% dividend. The stock has struggled this year, but is now priced attractively at 14 times earnings. This could be a Foolish buying opportunity if Wal-Mart gets its act together, which it just might.

As far as the business is concerned, there was plenty of good news last quarter about what the future holds. The company's traditional Supercenters aren't performing extremely well right now, but Wal-Mart's newer initiatives, including smaller stores and online sales, will help in future quarters.

Bob Ciura owns shares of Apple. The Motley Fool recommends Amazon.com and Apple. The Motley Fool owns shares of Amazon.com and Apple. 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.