What happened

Discount retailer Dollar General (NYSE:DG) gained 12% last month, according to data provided by S&P Global Market Intelligence.

The rally put the stock back into positive territory for the year, although it remains below the all-time high set last July.

DG Chart

DG data by YCharts.

So what

September's uptick followed the mixed operating results that the company announced just before the start of the month. Shares declined on Aug. 31 as investors focused on the retailer's softening profitability. Gross profit margin ticked lower in the fiscal second quarter thanks to increased promotions.

Two kids picking out candy at a store.

Image source: Getty Images.

That report wasn't all bad news, though. In fact, Dollar General logged an increase in customer traffic to mark an improvement over the prior quarter's decline. That boost, plus a healthy rise in average spending per visit, allowed comparable-store sales to rise by 2.6%, compared to a 0.7% uptick in the fiscal first quarter.

Now what

CEO Todd Vasos and his team described the retailing landscape as highly competitive, with grocery chains in particular jockeying for market share. Still, Dollar General continues to predict that revenue will rise by between 5% and 7% in 2017 as a slight comps increase combines with a rising store count.

The downtick in profitability isn't hurting its 2017 earnings forecast, either. In fact, the company now believes it will produce profit of between $4.35 and $4.50 per share, compared to the prior forecast that ranged from $4.25 and $4.50 per share. Those top- and bottom-line results would be impressive, given today's tough retailing environment.

Demitrios Kalogeropoulos has no position in any of the stocks mentioned. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.