Target Corp. has pulled out of a yearlong sales slump while department stores continue to struggle.

After four consecutive quarterly sales declines, the Minneapolis-based retailer said this morning that comparable sales in the May-to-July quarter rose 1.3 percent, driven by increased traffic and a 32 percent growth in online sales. Target's stock jumped 5 percent in premarket trading.

But the higher costs to fulfill online orders and the company's efforts to lower prices dragged down its bottom line. Target's net profit in the second quarter dropped 1.2 percent to $672 million, down from $680 in the same quarter a year ago.

Still,adjusted for one-time issues, its earnings per share was $1.23, essentially flat from last year and beating analysts' expectations of $1.19 and its own forecast of 95 cents to $1.15.

On Wednesday, Target also raised its expectations for the year, saying it now expects comparable sales to be in the range of plus or minus 1 percent, instead of single-digit declines. It also raised its profit guidance for the year to the range of $4.34 to $4.54, instead of its prior forecast of $3.80 to $4.20.

"While our recent results are encouraging, we will continue to plan prudently as we invest in building our brands, our digital channel, the value we provide our guests and elevating service levels in our stores," Target CEO Brian Cornell said in a statement.

Last month, Target first relayed that sales and traffic had begun to rebound, leading it to raise its forecase for the second quarter to moderately positive sales instead of single-digit declines. It said then that its efforts to remodel stores, improve its website and supply chain and lower prices were beginning to pay off. The company is investing $7 billion over the next three years on those initiatives as well as to roll out more than a dozen new house brands. A wave of four new brands in apparel and home are hitting stores in coming weeks as Target phases out older well-known brands Merona and Mossimo.

Target also said Wednesday that it is going to pick up the pace of its store remodels. It's on track to refresh 110 stores this year and plans to now give 300 stores makeovers in 2018, instead of 250. In total, the retailer is planning to overhaul more than a third of its 1,800 stores in the next few years.

Earlier this week, Target also announced the acquisition of Grand Junction, a San Francisco-based technology firm, in order to help it boost its same-day delivery capabilities and better compete with Amazon. And as it looks to boost its grocery offerings, which has been a weak spot for the retailer, it has enhanced its leadership in that area with the hiring of two new executives — one from Wal-mart, one from General Mills.

Target also is expanding its next-day $5 delivery service of household essentials called Target Restock. It first began testing the service among Redcard holders in Minneapolis in June. Now it is opening up the program to non-Redcard holders and to the Dallas and Denver markets.