Source: Wikimedia Commons

For decades, Wal-Mart Stores (WMT 0.10%) has been the unquestioned king of retail. Wal-Mart is a company of truly staggering size and scale. In fiscal 2014, Wal-Mart racked up $473 billion in sales. If it were its own country, Wal-Mart would be the 27th biggest in the world by gross domestic product, larger than Austria, according to the International Monetary Fund.

Wal-Mart grew from humble beginnings to a retail juggernaut with almost 11,000 stores under 71 banners across 27 countries worldwide. It did this with a laser-like focus on everyday low prices and an ironclad grip over its suppliers and distribution.

However, there are some serious cracks starting to form in Wal-Mart's armor. A wave of negative PR about how Wal-Mart treats its employees is taking a real bite out of the company. In response, consumers are increasingly flocking to Wal-Mart's chief rival, Costco Wholesale (COST 0.71%).

Even worse, Wal-Mart's core customer base is getting hit where it hurts. Cuts to the federal food stamp program are forcing Wal-Mart's customers to pinch pennies even more than usual. While Wal-Mart is still the biggest retailer in the world and likely will be for a long time to come, there are some dark storm clouds forming overhead.

When in doubt, blame the weather?
Wal-Mart continued a recurring trend for retailers after releasing poor first-quarter earnings, which is to blame lagging sales on the poor weather in the United States. In all, Wal-Mart's earnings per share clocked in at $1.10, representing a 3.5% decline year over year. Wal-Mart specifically cited the harsh weather as the primary culprit. However, it's worth noting that even excluding the impact from the weather, Wal-Mart's profits still would have fallen.

Blaming the weather is an all too frequent occurrence for retailers these days, but it amounts to a poor excuse for underperformance. Some retailers, such as Costco, are actually doing quite well, and Costco has to deal with the same weather conditions as Wal-Mart. To that end, Costco's U.S. same-store sales, which measure sales at locations open for at least one year, rose 4% through the past six months.

Furthermore, Costco's total same-store sales increased 3% over this period, which doesn't seem spectacular but looks better when you exclude gas price fluctuations and foreign currency effects. Adjusting for those items reveals that Costco's total same-store sales increased 5% in the most recent quarter and over the past six months. As a result, it's clear that Costco is doing just fine, even with the harsh weather conditions.

The real problem for Wal-Mart
What really seems to be hurting Wal-Mart and its customer base are the ongoing cuts to food stamps. Wal-Mart management has repeatedly stressed the importance of the Supplemental Nutrition Assistance Program, or SNAP, for its business. That's because roughly 20% of Wal-Mart's customers rely on the SNAP to pay for food, and Wal-Mart derives more than half of its sales from groceries. When you connect those dots, it's plain to see what's happening.

This also explains why Wal-Mart and Costco are performing so differently right now. Whereas Wal-Mart's customer base is heavily reliant on federal assistance programs, Costco's core demographic earns higher income on average. That provides some crucial insulation for Costco against the budget cuts that are putting such a strain on low-income households.

These conditions are likely to persist for some time, which is why Wal-Mart expects current-quarter earnings of $1.20 per share. That's more than 6% below the average analyst estimate.

The bottom line
Wal-Mart is still the unquestioned king of discount retailing. But that doesn't mean it can get too comfortable. There are several forces combining to threaten Wal-Mart's status as the industry juggernaut. Its customer base is under duress, it's facing a severe swing in public opinion for its employment practices that is pushing shoppers toward Costco, and its attempts to expand in the emerging markets aren't working out. If Wal-Mart isn't careful, it might just lose the top spot in the retailing space sooner rather than later.