Target shoppers are back in stores and clicking online in record numbers, handing the company its largest sales boost in 13 years just as it rounds the bend toward the busy back-to-school and holiday-shopping seasons.

The Minneapolis-based retailer’s stock price hit record highs on Wednesday after reporting that combined in-store and digital transactions were up 6.5 percent during the second quarter compared with a year ago.

With consumers finally starting to show some confidence amid the nation’s longest-ever bull-market rally, Target Corp. raised its profit outlook for the year, a sign that it expects shoppers to sustain this flush feeling despite talk of a trade war, rising interest rates and a potentially combative midterm election.

“Target is clearly capitalizing on a stronger consumer backdrop, seasonal drivers and market share opportunities,” Credit Suisse analyst Seth Sigman wrote in a note to investors, adding that the results were “well ahead of industry trends and some other competitor results.”

Shares were up more than 5 percent at one point, as Wall Street responded to the upbeat results, and settled some to close Wednesday at $85.94, up about 3.2 percent.

Earnings for the quarter topped analysts’ expectations, rising more than 20 percent over the same quarter last year to $1.49 per share on sales of $17.8 billion.

The company now expects adjusted earnings per share for the fiscal year to range from $5.30 to $5.50, an increase of 15 cents per share at the low and 5 cents at the high end.

Retailers in general are seeing an uptick in sales, as rising wages, lower unemployment and tax cuts take a little pressure off household budgets.

Walmart, Kohl’s and TJX also reported big gains, helping to fuel the best retail earnings quarter in eight years, retail analyst Ken Perkins noted. Perkins, of Retail Metrics, predicts combined overall earnings for the nation’s publicly traded retail companies to weigh in at around 20 percent.

Target said all of its product categories showed strong results and gains in market share during the quarter.

“The lion’s share of our traffic was driven by our current guests shopping more often, shopping more categories,” said Target CEO Brian Cornell, who noted the boost in store traffic was unprecedented in the last decade.

The company’s higher-margin home-decor category was a standout performer, showing a 10 percent bump in sales for the quarter. Executives highlighted the strength of Target’s store brands, particularly its Made By Design line.

With the last of the Toys ‘R’ Us stores now closed, Target is making a strong play to grab market share in babies and toys, particularly during the holidays. The company is increasing inventory now to prepare for a surge that already is showing up in stores.

Target also stands to gain as Sears shrinks its footprint nationwide and Bon-Ton Stores Inc. liquidates all of its stores, which includes Herberger’s and Younkers.

“There are going to be billions of dollars of retail market share up for grabs,” Cornell said, “and we’re going to position ourselves to take more than our fair share of that.”

Target will spend $3.5 billion this year in remodels and store openings, burrowing into busy hubs in New York City, Boston and Chicago where shoppers haven’t had easy access to the brick-and-mortar experience.

Target aims to remodel about 300 stores this year and next, about triple the number last year. The updated stores have given the retailer an average 2 to 4 percent lift in sales — proof, its leaders say, that shoppers are responding to its wall-to-wall face-lifts as well as new, smaller-format stores in urban areas and near college campuses.

Online sales, while still accounting for less than 6 percent of overall revenue, continue to build. Digital revenue jumped 41 percent during the quarter, on top of 32 percent growth a year ago.

In its quest to combat Amazon in simplicity and swiftness of delivery, Target has focused this past year on improving and expanding services that are blurring the line between online and in-store purchases.

The company said 95 percent of online orders for in-store pick up are ready within an hour. Drive-up orders, now available at 800 stores in 25 states, offer a wait time of less than 2 minutes.

But meeting shoppers’ hunger for immediate gratification and a seamless online-to-store transaction requires more training and sophisticated technology. Combined with store remodels and modest wage hikes for front-line workers, the cost of these initiatives continues to cut into profit margins, though with less effect than previous quarters.

Operating income was $1.13 billion, an increase of 3.6 percent from the same time a year ago.

Moody’s lead retail analyst, Charlie O’Shea, said the company’s investments of “short-term pain for long-term gain” are starting to pay off.

“The raising of guidance for the back half of the year is consistent with our view that there are macroeconomic tailwinds that can be exploited by the strongest, most financially flexible retailers that are hitting on all cylinders,” O’Shea said, “with Target definitely in that class.”