More higher-income consumers are shopping at Walmart (WMT -0.08%) these days, indicating the growing pressure that rising interest rates, persistently high inflation, and elevated gas prices are having on the economy.

The retail giant recently reported its fourth-quarter earnings, and while they showed Walmart remains financially sound, it could portend a market downturn is coming. Because there is significant economic weakness, this report could be a yellow flag for what is on the horizon.

Recession warning sign in a storm.

Image source: Getty Images.

Bargain hunting in the grocery aisle

Walmart delivered strong revenue growth globally for the latest quarter, with sales rising almost 8% on a constant currency basis to hit $164 billion. Comparable-store (comp) sales were up over 8% and were nearly 14% higher on a two-year basis as Sam's Club comp sales raced ahead 12% and 22%, respectively. Consumers are apparently stocking up and finding that buying in bulk is the way to get better value as prices for groceries and other goods keep rising.

Even e-commerce sales were strong, jumping 17% in the fourth quarter in the U.S., a notable gain considering that Amazon (NASDAQ: AMZN) only saw a 14% rise in currency-adjusted U.S. sales. 

Walmart's strength was in groceries, which saw comparable sales in the high-teens percentage range. Yet since food inflation was up in the mid-teens percentages, a figure well above the stated national inflation rate, it seems the retailer's gains are really being driven by higher prices.

Moreover, more than half of the growth in groceries is coming from high-income consumers who are finding it necessary to shop down market. Although that can be a long-term benefit for Walmart as many of those new customers may end up staying with the retailer after inflation finally subsides, it suggests these are especially tough times.

It also indicates consumers are hunkering down and just buying the basics. Walmart general merchandise sales declined by mid-single-digit rates with the retailer noting widespread softness across toys, electronics, home goods, and clothing. Health and wellness was up by low double-digit percentages, but as with food, it carries much lower margins.

So while sales of those product categories rose by 330 basis points all (fiscal) year and also gained market share, they are generating much narrower profits.

Clouds on the horizon

It's a situation that is likely to continue. Despite posting relatively robust results, Walmart forecast U.S. sales will rise 5% at most on a constant currency basis and comps will be up just 2% to 2.5%. The company projected that profits are going to fall to a range of $5.90 to $6.05 per share from $6.29 per share last year.

It's a weak outlook that should be worrisome for investors. A survey by the National Association for Business Economics warns that 58% of economists believe there is more than a 50% chance of a recession in the next 12 months, with 33% predicting it will come in the second quarter and 21% believing it will start in the third.

Person shocked by grocery bill.

Image source: Getty Images.

While Walmart looks well-positioned to continue gaining market share even during a downturn, it has been returning more cash to shareholders than it was generating in free cash flow. Cash profits grew to $12.2 billion for the year, but Walmart paid out $6.1 billion in dividends and repurchased $9.9 billion worth of stock for a total of $16 billion. That's not something investors would want to see the retailer do for an extended period of time.

Finding safe harbor in a storm

Walmart looks like it's waving a yellow flag on the economy. Sales are up, but profits are down and are likely going to keep falling. More well-heeled customers are finding it necessary to go discount shopping for groceries. When even high-income households are pinching pennies, it is a warning sign for the rest of us.

Investors may want to use the opportunity to beef up their positions in defensive stocks that can weather a downturn, or even thrive. At 20 times next year's earnings estimates, Walmart itself isn't exactly a discounted stock, but could still be one to provide long-term shelter from any storm.