Target Corp. is not yet out of the woods, but the Minneapolis-based retailer now has a little more pep in its step heading into the heart of the holiday shopping season.

After sales and traffic slumped over the summer, the company reported a partial bounceback in both metrics in the August-to-October quarter and lifted its sales and profit outlook for the critical holiday quarter.

The better-than-expected results were a relief to Wall Street, which sent Target’s shares up 6.4 percent to close Wednesday at $76.03.

While Target Chief Executive Brian Cornell spoke about a cautious consumer earlier this year, he joined a growing chorus of voices from other retailers who recently expressed brighter hopes for the holidays amid rising wages and consumer spending. That is despite potential challenges such as warmer weather heading into the season and other possible distractions, such as the surprising end to a contentious election.

“Obviously it’s been a very unusual November — that’s probably the ultimate understatement,” Cornell told reporters.

“We continue to be very optimistic about the overall consumer environment,” he said. “We recognize a lot of people were at home last week watching TV. But we expect — as our business and our competitors begin to focus on the holidays — we expect that consumer to be in that holiday mode.”

Target now expects comparable sales in the fourth quarter to fall in the range of up 1 percent to down 1 percent, an improvement from its previous guidance of sales being flat to down 2 percent. That compares to a 1.1 percent slide over the summer that rebounded to a 0.2 percent drop in the third quarter.

The company continues to face the same challenges that have dogged it in recent months, including lower sales in its grocery department, soft electronics sales and disruption in its pharmacies since being taken over by CVS. Executives said Wednesday that they have seen positive signs in some of those areas including a stronger interest in Apple products such as the iPhone 7. Preorders for some items significantly surpassed last year’s demand.

And then there’s the issue of driving customers back to the stores. Traffic dropped 2.2 percent over the summer, one of Target’s biggest declines since the recession. Although it improved in the third quarter, it was still down 1.2 percent.

To lure shoppers, Target has been working to make promotions and household essentials such as food and other staples a bigger part of its marketing.

“We believe those changes were instrumental in driving improved traffic and comp sales in the third quarter,” Cornell told analysts on a conference call. “Going forward, we are committed to striking the appropriate balance in all of our marketing communications.”

Amy Koo, an analyst with Kantar Retail, noted that Target relied on the help of its vendors to do so.

“A lot of the promotions were being funded by vendors,” she said.

Target’s online sales also grew at an impressive rate of 26 percent in the third quarter, helped in part by a one-day promotion over the summer that gave shoppers 10 percent off most items online and in its stores. But Target must contend with heightened competition from as a greater share of the spending is moving online. Target’s online share, while growing, is still fairly small.

Still, Target’s sales goal for the season is still a far cry from the 2.5 percent goal executives set at the beginning of this year.

Brian Yarbrough, an analyst with Edward Jones, gave Cornell and his team credit for managing expenses and inventory that, along with aggressive share buybacks, have helped grow earnings per share in a year when Target’s sales have underperformed. He added that the results were better than he expected given recent departures of top executives including the chief marketing officer, chief digital officer and grocery chief.

“But if you just step back from the quarter, the same concerns remain,” he said. “Traffic is still negative. Food is still a drag.”

He added that the stock rally on Wednesday was largely a reflection of a considerable number of investors who had a short position in the company.

For his part, Cornell said he was “very pleased” by the third-quarter results that were boosted by a strong back-to-school season with sales growth in higher-margin areas, such as home and apparel. The new Cat & Jack kids apparel brand performed particularly well in the quarter, he added.

Cornell said restoring sales growth and traffic to the stores is his highest priority and said he would lay out plans at an investors’ meeting in February.

At the same time, he emphasized that the company’s increased profitability despite these challenges demonstrated the company’s resiliency. About $2 billion in cuts the retailer has undertaken in the past two years has helped. He added that executives have identified more areas for additional savings in future years.

In the three months ended Oct. 29, Target’s net earnings were $608 million, or $1.06 a share, up 11 percent from $549 million, or 87 cents a share, in the same period a year ago. Adjusted for one-time expenses, Target earned $1.04 cents a share, which was better than the 83 cents analysts had expected.

Revenue was $16.4 billion, down 6.8 percent from $17.6 billion a year ago, chiefly reflecting the absence of the pharmacy business it sold to CVS Health Corp.

Department stores Macy’s, Kohl’s and J.C. Penney reported lower quarterly sales in the last week, while the parent of T.J. Maxx and Home Depot posted strong quarterly sales. Wal-Mart and Best Buy will report their quarterly results on Thursday.