A continued shift to online shopping in an economy deeply affected by COVID-19 helped propel Target to its biggest sales jump in company history.

While customers concentrated on groceries and essential items in the early weeks of the corona­virus outbreaks in the U.S., late spring brought additional growth in discretionary spending. Target customers snagged home office items, video games, home decor and even apparel.

Added to skyrocketing digital sales, more people also started to shop in person again, all resulting in a 24.3% increase in sales for May, June and July.

Chief Executive Brian Cornell said the second quarter proved Target’s strategy of remodeling stores while strengthening its online ordering and fulfillment is proving itself.

“We continue to see guests shop our stores and I think the investments we made in safety, the investments we made in our team, the investments we have been making for years and years putting capital into remodeling our stores and creating a great shopping environment, that’s certainly connecting with the guest during the pandemic,” he said.

The Minneapolis-based retailer on Wednesday reported that profits for the quarter grew 80% to $1.7 billion, or $3.35 a share.

Investors took notice, with shares closing up 13% to a record $154.22.

“Target’s Q2 performance obliterated the bull’s-eye, with every line item vastly exceeding our expectations, resulting in first half performance actually improving from 2019 despite Q1’s very rocky start,” said Moody’s retail analyst Charlie O’Shea in a statement.

The back-to-school season has gotten off to a slower start than usual because of the uncertainty of in-school learning, but early August numbers show sales growth in the low to mid teens, Cornell said.

And while the second half of the year, including the important holiday season, will likely be just as unpredictable, Target is well-positioned to adjust to conditions, he said.

Physical store comparable sales in the second quarter jumped 10.9%.

Online sales were up nearly 200%, accounting for 13.4 percentage points of Target’s overall sales growth. The company said it had 10 million new digital shoppers in the first half of its fiscal year. In June, Target started to roll out fresh and frozen groceries for pickup nationwide.

Together, the retailer’s same-day online services such as store pickup, drive-up and Shipt delivery grew 273%. Drive-up alone grew more than 700%.

Walmart on Tuesday also reported a strong second-quarter with online sales doubling. Home Depot reported a 23.4% increase in same-store quarterly sales year over year, and Lowe’s reported Wednesday a same-store sales increase of 35% with online sales doubling.

It has set up a dynamic with big-box stores the winners in a troubled economy deeply affected by COVID-19. Kohl’s on Tuesday was the latest department store to report revenue decreases for the quarter.

In the first half of the year, Target earned $5 billion in market share gains, surpassing all of what the retailer accomplished last year.

Last quarter, Target’s operations began to show signs of returning to a state of semi-normalcy. For example, the retailer began to accept returns again in late April and reopened its in-store Starbucks coffee locations. Store construction has also begun to ramp up with the retailer on track to open close to 30 stores this year with nine slated for this month.

As people continued to spend more time at home because of the pandemic, sales of electronics such as office equipment and gaming systems grew more than 70%, the most of any category this quarter. Home grew more than 30%. Beauty, food and beverage and essentials all experienced about 20% increases. Apparel went from a 20% dip in sales in the first quarter to double-digit growth.

Target’s own brands have also performed well with food brand Good & Gather hitting $1 billion in sales less than a year since it was first introduced, joining other billion-dollar Target brands like Threshold and Cat & Jack.

Despite the record-breaking quarter, though, the ongoing pandemic as well as the current economic crisis that has left many unemployed are both large unknown factors to Target’s bottom line.

“We can expect a hard-fought election and a holiday season that like so much of this year is likely to be unprecedented,” Cornell said, on a call with media. “Through it all, we will continue taking actions to assure a safe, convenient, consistent shopping experience and we will continue to invest in our team.”

Plus, as online sales continue to change retail, Brian Yarbrough, an analyst with Edward Jones, said he had concerns about how well Target could perform in the future against competitors like Walmart and Amazon.

“We believe the company is facing increasingly competitive pressures from internet retailers, and the company’s online sales are not as profitable as sales in physical stores due to the costs for shipping goods,” Yarbrough wrote in a report on Wednesday.

Retailers, he said, will start to see pressure on profits during the second half of the year as the United States Postal Service and shipping companies like FedEx and UPS begin to raise prices during the holiday shopping season.

This report includes material from the Associated Press.