What happened

Shares of Walmart (WMT 0.46%) were up 5% as of 10:10 a.m. ET on Tuesday after the retailer announced results for the fiscal second quarter of 2023. The company reported a 6.5% increase in U.S. same-store sales, up from 3% in the previous quarter. Adjusted earnings per share came in at $1.77, beating analysts' estimates of $1.63. 

The stock has recovered some of the recent losses that occurred following the fiscal first-quarter earnings report three months ago. Year to date, Walmart has outperformed the S&P 500, down just 3.2% compared to a 10% decline for the index. 

So what

The quarter went much better than the previous outing, when Walmart's profitability took a hit over unfavorable pricing and staffing levels, as well as higher container and storage costs. This time, operating expenses decreased slightly as a percentage of net sales, which helped the company beat earnings expectations.  

Higher inflation boosted Walmart's average transaction size, which lifted same-store sales. At the same time, the company is reducing costs, while also holding prices as low as possible in essential categories like private brand, food, and consumables. 

Now what

Management expects a strong finish to the back-to-school season, and CEO Doug McMillon also feels good about the fall and holiday product lineup. He noted Walmart will have an improved inventory position in the back half of the year, which should lead to solid earnings performance. 

Investors look at established companies like Walmart that sell everyday essentials as ideal stocks to invest in during challenging economic times. It didn't live up to that last quarter, but management has made great progress to correct those issues and appears well positioned to deliver strong results to finish the year.