Target’s shelves are better stocked than ever before. It has added thousands of new grocery items. And it has rolled out new offerings such as the jazzy in-house Cat & Jack kids clothing line.

So why haven’t shoppers visited Target Corp.’s stores in the last few months as they have in the past?

That was the troubling question on analysts’ minds after the Minneapolis-based retailer reported a surprising 2.2-percent drop in traffic during the May-to-July period — its first decline in that metric in a year and a half, and the biggest slide it’s seen since the Great Recession outside of the massive data breach a few years ago.

The company’s shares tumbled in trading Wednesday as Target also reported its first comparable U.S. sales drop in two years and lowered its forecast for the second half of the year, including during the holidays, when it now expects sales to be flat to down 2 percent.

It was a stark change from several months ago when Target executives said sales could grow as much as 2.5 percent this year.

The stock closed Wednesday at $70.63, down $4.85 or 6.4 percent.

Target CEO Brian Cornell said the company is working closer with CVS on campaigns to bring pharmacy customers back.

Target executives offered their own explanations for the falloff in traffic: They lost some trips to in-store pharmacies amid the rebranding of them to the CVS Health banner. Electronics sales were down double digits — Apple products in particular slumped more than 20 percent. And an overhaul of the grocery department to include more specialty and organic items is still not hitting the mark with consumers.

But analysts also wondered if there were deeper issues at play — in particular, Target’s ability to hold off the mounting threat from Amazon.com.

“Clearly this was a step in the wrong direction,” said Sean Naughton, an analyst with Piper Jaffray. “Some of the concern is now going to be about Amazon’s continued success and the potential for Prime Now [Amazon’s delivery service within two hours on select items] becoming more ubiquitous across the country with people being able to get things more quickly.”

Brian Yarbrough, an analyst with Edward Jones, downgraded Target’s stock on Wednesday from buy to hold amid concerns that Target’s business is stalling. Aside from Amazon, he said Target may also be losing some ground to dollar stores as well as to Wal-Mart, which has been sprucing up its stores and vowed to become more aggressive on grocery pricing.

“When you combine those three, it’s a slow bleed,” he said. “How is it going to get any easier for Target? It’s not.”

The quarterly results and lowered guidance is the first major setback for Chief Executive Brian Cornell who is two years into the job. Until now, he had been riding a wave of modest gains in comparable sales every quarter as he put a bigger emphasis in revitalizing the categories of style, home, baby and kids. At the same time, he’s made some big moves such as shuttering the company’s struggling stores in Canada, selling its unprofitable pharmacies to CVS and laying off thousands of headquarters employees.

“I think [Cornell] has done a lot of great things, but a lot of the low-hanging fruit is gone,” Yarbrough said. “So where do you go next?”

On Wednesday, Cornell assured investors the company would show more improvement over the long term. In the short term, he said his team would work to “rebalance” some of its initiatives that had strayed a bit too far on the “expect more” side of Target’s brand promise. So they will focus more on emphasizing the value proposition, or the “pay less” side of the equation, in its marketing, promotions, and store displays.

“We’re not altering our strategic focus,” he said. “It’s making sure we get our strategies in balance and we deliver against both signature categories and those important household essentials that drive traffic to our stores and put cars in the parking lot.”

Target’s grocery department is an area that is designed to help drive shopping trips since customers shop for food more often than discretionary items. But despite adding more than 1,000 natural, organic and gluten-free products, having a better in-stock record and adding new displays, Target still saw a small sales decline in groceries in the quarter.

Food deflation and heightened competition among a number of strong regional grocers were cited as additional factors. But Cornell did not seem fazed.

“We’re going to play to win in food,” he told investors. “We’re going to continue to roll up our sleeves and make sure we’re into the details finding ways to to unlock the growth potential in that critically important category.”

In addition, he said Target is going to work closely with CVS on marketing campaigns to bring pharmacy customers back in. And he’s having Target’s new chief merchant, Mark Tritton, reach out to its electronics vendors such as Apple to find ways to bring a different and new assortment to stores in time for the holidays.

Earlier this month, Target began selling Amazon Kindle and Fire tablets after pulling its competitor’s products from its shelves four years ago.

One bright spot for Target was apparel sales, which is notable since that category has been soft industrywide leading to slipping sales at many department store chains such as Macy’s, Nordstrom and Kohl’s. Last week, Macy’s announced it will shutter about 100 stores next year, about 14 percent of its namesake stores, as it looks to turn around its business.

Meanwhile, consumers have been more interested in spending money at home-improvement retailers such as Home Depot as they remodel their homes. Off-price chains such as TJX Cos., the parent of T.J. Maxx, have been doing well, too. Wal-Mart will report its quarterly results Thursday.

In the second quarter ended July 30, Target’s sales at existing stores dropped 1.1 percent, its first such decline since the first quarter of 2014 when sales slid 0.3 percent.

Revenue was $16.2 billion, down 7.2 percent from $17.4 billion from the same period a year ago when pharmacy sales were still included in Target’s results. Online sales rose 16 percent.

Target’s net profit dropped 9.7 percent to $680 million, down from $753 million in the same period a year ago. But when adjusted for one-time expenses, earnings were $1.23 a share, higher than expectations as the company offset some of its challenges with cost cutting.

Executives lowered Target’s full-year guidance for adjusted earnings to a range of $4.80 to $5.20 per share. They previously forecast a range of $5.20 to $5.40.

Cathy Smith, Target’s chief financial officer, said the uneven sales and traffic trends were one consideration in the outlook. But she added that they were also being conservative because it is easier and more profitable to ramp up inventory and employee hours if sales trends improve rather than having to pull back.