Target (TGT) reported better-than-expected sales growth in July that matched the company’s own expectations as traffic improved despite a frail economy.  

The Minneapolis-based retailer reported comparable-store sales – a key growth metric for retailers – of 3.1%, better than the 2.7% forecasted by analysts in a Thomson Reuters poll.

Total sales for the four weeks ended July 28 were $5 billion, up 3.2% from $4.8 billion a year ago.

“We’re pleased with target’s July comparable-store sales increase,” the company’s chief executive, Gregg Steinhafel, said in a statement, adding that it was “right in line with our expectations going into the quarter.”

He attributed the gains to innovative merchandising, a remodel program and 5% REDcard Rewards that together drove increases in traffic despite a “consumer environment that remains quite challenging.”

Shares of Target climbed about 2.2% to $62 on Thursday and are up about 21% so far this year.

Follow Jennifer Booton on Twitter at @Jbooton