(Bloomberg) -- A makeover at Dollar General Corp. is beginning to get results.

The retailer posted strong sales on Thursday, boosted by new customers streaming into the discount chain. Shopper traffic -- and the amount they spent -- grew in the third quarter, helping send the shares on their biggest rally in about six months.

Dollar General has been upgrading its stores and adding hundreds of new locations -- part of a bid to go after a broader swath of shoppers, including a more upscale consumer who might not typically visit a dollar store.

“We are encouraged by the early progress,” Neil Saunders, managing director of GlobalData Retail, said in a note. “The company is capturing a more significant share of spending from middle income and more affluent Americans.”

Third-quarter profit amounted to 93 cents a share, missing analysts’ estimates by a penny. But comparable sales growth -- a closely watched measure -- came in at 4.3 percent. Analysts had projected 2.7 percent, according to Consensus Metrix.

The company now expects sales to grow 7 percent this year. It had previously forecast a range of 5 percent to 7 percent. It also narrowed its profit guidance, saying earnings would be $4.37 to $4.47 a share.

The stock gained as much as 6.3 percent to $96.60 on Thursday, marking the biggest intraday increase since June 1. The shares had climbed 23 percent this year through Wednesday’s close.

At a time of broader retrenchment in the retail industry, Dollar General is on a store-opening binge. Next year, it plans to add 900 new locations and remodel 1,000 current stores. It’s also relocating 100.

“Almost 75 percent of the population now live within five miles of a Dollar General store,” Saunders said. “This makes the company the closest and most convenient general merchant for millions, especially those living in rural areas.”

(Updates shares starting in second paragraph.)

To contact the reporter on this story: Nick Turner in New York at nturner7@bloomberg.net.

To contact the editor responsible for this story: Nick Turner at nturner7@bloomberg.net.

©2017 Bloomberg L.P.