Walmart's stock price soared to an all-time high Thursday following an upbeat earnings report.

It's a sign of growing investor confidence around the company's strategy of targeting customers at the highest and lowest ends of the income spectrum.

Walmart is on a tear.

The company's stock soared more than 10% on Thursday following an upbeat earnings report, which included 2.7% same-store sales growth at US stores, heading into the critical holiday season. Analysts applauded the company's performance across the board, with Gordon Haskett analyst Chuck Grom declaring it a "monster quarter" in which Walmart "hit it out of the park."

The rally appears to be more than a reaction to strong sales and earnings growth, however.

It's also a sign of growing investor confidence in Walmart's strategy to attract new customers by targeting shoppers at both the highest and lowest ends of the income spectrum, according to Doug Stephens, a retail-industry consultant.

"If you’re Walmart, your choice has become binary: If you want to grow your business you either extend further down, which is treacherous and low profit at best, or you move upmarket, which is a much better choice, if they can pull it off," Stephens said.

Investors seem to think Walmart can pull it off.

The retailer has been targeting high-income customers through recent acquisitions of upmarket brands like Bonobos, Modcloth, and Shoebuy, and the more recently announced addition of Lord & Taylor to Walmart.com.

The company says it has plans to turn its website into a "premium fashion destination," according to Denise Incandela, the head of fashion for Walmart US e-commerce.

At the same time, Walmart appears to be maintaining loyalty among customers at the opposite end of the income spectrum by keeping prices competitive and adding new in-store discounts that its rivals — most notably Amazon — will have a hard time beating.

"Walmart continues executing well in a generally solid US consumer environment with the combination of offensive marke- share gaining moves and defensive inventory and pricing execution," Cowen & Co. analyst Oliver Chen wrote in a recent note to clients.

Walmart's strategy overlooks the middle class

Walmart's strategy puts less emphasis than ever before on a group that was once it's prime target: the middle class, according to Stephens.

"In the 1960s, retailers couldn’t keep up with the growth of the middle class," Stephens said. "Wages were growing, families were growing, and people were moving out to the suburbs. That played very well into Walmart's playbook."

Now the middle class is shrinking, and big-box retailers and department stores that once appealed to the middle class are being forced to change their strategies or go bankrupt.

"More and more people are dropping out of middle class and dropping into working class; hence the appeal and the growth of dollar stores," Stephens said. "If Walmart is going to succeed they need to attract higher-income consumers."