Target Corp.'s wide-ranging efforts to lower prices, offer more stylish fashions and improve its website and groceries seem to be paying off.

Those initiatives helped pull the Minneapolis-based retailer out of a yearlong sales slump as it struggled to keep up with Walmart and Amazon.

On Wednesday, Target reported better-than-expected second-quarter results with comparable sales rising 1.3 percent, mostly driven by a 32 percent jump in online sales.

Wall Street approved, sending Target's shares up 4 percent. But analysts remained a bit tempered in their excitement because Target said it would increase its capital spending to remodel more stores next year and continue lowering prices and also indicated the shift to online sales would continue to weigh down profits.

"After a long run of decline, green shoots are finally showing at Target," Neil Saunders, managing director of GlobalData Retail, wrote in a research note.

The recent "Target Run and Done" marketing campaign, he said, has helped shift consumer perceptions of Target's prices as the retailer pared back promotions to shift to more of an everyday low pricing model.

Mark Tritton, Target's chief merchandising officer, said on a conference call after the earnings release that the changes are driving more quick, fill-in trips to the store, which had been on the decline a year ago.

Tritton acknowledged that Target executives expect some friction as they become more targeted and selective with promotions, but he said surveys show that consumers are already taking notice of Target's lower prices.

"It's working: In fact, our second-quarter balance of regular and promotional sales were consistent with levels we haven't seen since 2012," before the massive data breach in 2013 when Target began stepping up its promotions to win shoppers back, he said.

However, some analysts have noted that this could be a tricky road for Target especially because Walmart also has been lowering its prices. Also, while analysts acknowledge that Target should be investing in these areas, they note it's also taking a toll on profits.

The higher costs to fulfill online orders and the company's efforts to lower prices dragged down Target's bottom line in the second quarter. Its net profit dropped 1.2 percent to $672 million, down from $680 million in the same quarter a year ago. Adjusted for one-time costs and benefits, its earnings per share were $1.23, essentially flat from last year but above expectations.

Target's grocery sales, which have been a weak part of its business, were flat in the May-to-July quarter, which executives noted was an improvement. The segment was driven by a double-digit jump in beer and wine sales. Fresh produce sales — which Target has worked to improve with product freshness, pricing and availability — saw single-digit growth.

"Given continued competitive and deflationary pressures in food, we're pleased that we're seeing signs of early progress," Target CEO Brian Cornell told analysts on Wednesday.

Target is looking to further improve its grab-and-go meal options and enhance its private-label offerings in groceries, which currently include Archer Farms and Market Pantry. Earlier this week, the company announced that two grocery veterans from General Mills and Walmart will start next month.

"They've stabilized the business," said Brian Yarbrough, an analyst with Edward Jones. But he added that Target still has a tough road ahead with groceries. Plus, some of the tailwinds the retailer benefited from in the quarter — such as a big jump in video game sales driven by the Nintendo Switch — may be short-lived.

So investors are waiting to see if Target can sustain the momentum especially given the competitive pressures in the difficult retail landscape in which many retailers, including department stores, continue to struggle.

"They need to show growth over several quarters," said Yarbrough.

In addition to groceries, Target also saw progress in other problem areas. After the bumpy transition of its pharmacies to CVS last year, prescriptions have finally begun to show positive signs. And the retailer has seen a 30 percent drop in complaints coming into its customer service center about its digital orders.

In the second quarter, executives said Target saw growth across most of its categories, driving market-share gains in apparel, home, electronics and household essentials. Bright spots included swimwear, board games and kids apparel, the latter of which continues to see strong gains from the Cat & Jack brand that Target launched last year that just hit $2 billion in sales, surpassing initial projections.

Target is following up Cat & Jack's success by rolling out four new house brands this fall in women's and men's apparel and home decor as it phases out well-known brands such as Merona and Mossimo. In total, the company plans to launch more than a dozen new brands in the next two years.

That effort is part of the $7 billion in investments Target is making over the next three years to revive its business. Other initiatives include remodeling hundreds of stores, opening more small-format stores in cities and near college campuses, and overhauling its supply chain.

On Wednesday, executives said they will refresh more than 100 stores this year and will up the pace next year, updating 300 stores instead of the original goal of 250.

Target is also working to roll out more fulfillment capabilities as it tries to catch up with Amazon and Walmart. Earlier this week, Target announced the acquisition of Grand Junction, a San Francisco-based technology firm, which will help it boost same-day delivery to more stores in New York City this fall.

The retailer also is expanding its Target Restock, its relatively new next-day delivery service of household essentials, to seven more markets this fall, executives said Wednesday. And Target will roll out a pilot of curbside pickup to the public this fall at a handful of stores around the Twin Cities after initially testing it among employees.

While CEOs of Walmart and other large corporations have recently waded into the political realm, criticizing President Donald Trump's recent statements on the events in Charlottesville, Va., Cornell stayed out of the fray when queried about it by reporters.

"We've got to be focused at Target on the things we can control," he said.

Kavita Kumar • 612-673-4113