Walmart (WMT  ) shares were 7% higher following the company's better-than-expected Q3 earnings season. The company noted that consumer spending remained strong especially with customers prioritizing value. It also said that bottlenecks and inventory issues have improved since last quarter. Groceries were the biggest driver of growth and a major factor in its earnings and revenue beat.

Overall, Walmart shares are up 3% YTD which is significantly better than the market averages. However, shares are up 25% since mid-June which accounts for nearly all of its outperformance. It's also fitting that Walmart is starting to outperform just as inflation risks recede and recession risks start mounting.

Inside the Numbers

In Q3, Walmart reported $1.50 per share in earnings which beat expectations of $1.32 per share in earnings. Revenue also topped expectations at $152.8 billion vs $147.9 billion. Overall, revenue was up 9%, while the company's earnings were down more than 50% from last year. The company lost money on an absolute basis due to a ruling against pharmacy providers which resulted in a $3.3 billion settlement from the company.

Walmart attributed its better than expected performance to strength in groceries in addition to a strong back-to-school season. E-commerce also continues to grow as digital sales were up 16% compared to last year. Another source of growth is its ad business which is up 30% due to the growth of its online marketplace.

However, the company did warn that they noticed consumers are trading down to lesser expensive items like beans, peanut butter, and hot dogs instead of more expensive meats. Customers are also more likely to wait for sales when making purchases and spending on apparel and home items is also depressed.

For many companies, this is a headwind, but it's a boost to Walmart's business as it sees more traffic to stores. Additionally, the company has been successful in attracting more high-earners to its stores due to the growth of its grocery business in concert with inflationary pressures. Walmart's strategy to not aggressively raise prices in order to grow market share also seems to be working. Currently, the company has maintained pricing on Thanksgiving items from last year.

For the next quarter, Walmart sees earnings per share declining by about 4% while revenue should be up 3%. The company said that the early weeks of Q4 were promising, although other retailers are sending a different message.