The discount retailer said on Wednesday that comparable sales, a key metric for retailers, rose 1.3% in the second quarter, breaking a three-quarter streak of declines and giving investors hope that Target is getting back on track after a bumpy year. The sales increase blew past the 0.7% jump Wall Street analysts were expecting, according to Consensus Metrix.

Target shares rose 4% in premarket trading.

Most encouragingly for the retailer, shopper visits were up 2.1% despite e-commerce soaring 32%. That suggests that its efforts to make the in-store experience more enticing – including better product presentation and in-store pick up services for online orders – are working. Those have been two of the biggest challenges for the company in recent quarters.

Target has made outsized bets on what it calls its “signature categories” – product areas like children’s products and health and wellness items – that it wants to dominate and that get customers into stores. It has also been refreshing some store brands and creating new…