Walmart shares hit all-time high, as retailer's value focus attracts shoppers and investors
Walmart, known for its giant stores and low prices, has put up strong results over the past year even as U.S. consumers have pulled back on discretionary purchases like new outfits, flat-screen TVs and more. It is the largest grocer in the country and makes more than half of its annual revenue from groceries — a category that shoppers need, even when inflation or a recession stretch their budgets.

The big-box retailer's stock hit a peak of $166.30 earlier in the day. That marks the highest since Walmart first began trading on the New York Stock Exchange in August 1972.

Shares of Walmart touched an all-time high Friday, as investors bet that the discounter will outmatch retail rivals and draw shoppers throughout the holiday season because of its reputation for value.

That business has helped Walmart draw foot traffic, even as other retailers like Macy's and Target give cautious outlooks and see weaker results.

For Walmart, sticky inflation — particularly in categories like food and household essentials — has also become an opportunity to get new or less frequent shoppers to come to its website and stores. In calls with CNBC over the past few quarters, Chief Financial Officer John David Rainey said the company has attracted more grocery shoppers from households that make more than $100,000.

As those shoppers come to its stores and website, they're seeing ways that Walmart has tried to step up the customer experience to keep up with more polished, tech-savvy rivals like Target and Amazon . The company has launched and expanded fashion-forward clothing brands. It has given its website and app a makeover. It's investing more than $9 billion over the next two years to upgrade its stores across the country and give them a modern look. And it's added more items and higher-end brands to its website through its third-party marketplace.

Walmart has also defied another dynamic in the retail industry. As Covid pandemic gains fade away and most companies post online sales declines, it has put up double-digit e-commerce gains for its U.S. business in the past two quarters.

In an interview with CNBC in August, Rainey said Walmart may attract customers with its prices, but wants to beat competitors and retain those shoppers by making it quick and easy to get purchases. Curbside pickup and delivery have driven the company's e-commerce growth, he said.

"It really shows that the value proposition for Walmart is much more than just low prices or value. It's convenience today," Rainey said. "And so we're leaning heavily into that and really both aspects of this part of our business."

As the company outperforms many of its peers, some investors have taken notice. So far this year, Walmart's shares have climbed nearly more than 16%. That outpaces the more than 13% gains of the S&P 500 and the approximately 3% gains of the retail-focused ETF, the XRT, during the same time period.

Walmart is scheduled to report its fiscal third-quarter results on Nov. 16.

— CNBC's Christopher Hayes contributed to this story.