(Reuters) - Target Corp TGT.N reported its best comparable-sales growth in 13 years and said a strong economy lifted customer visits to the most in a decade, sending its stock to a record high on Wednesday.

The Minneapolis-based retailer also raised its annual profit forecast and said its quarterly performance was driven by demand for home products, toys and electronics as well as a rebound in seasonal merchandise sales after cold weather in the first quarter hurt demand.

An extra week of back-to-school spending in the second quarter versus a year earlier along with a one-day sale in July to compete with Amazon.com Inc's AMZN.O Prime Day, also boosted performance.

Chief Executive Officer Brian Cornell said the jump in customer traffic during the second quarter was unprecedented. Store traffic grew 6.4 percent from a 2.1 percent gain during the same period a year earlier.

“There’s no doubt that like others, we’re currently benefiting from a very strong consumer environment, perhaps the strongest I’ve seen in my career,” he said. The retailer recorded market share gains across most categories, he added.

Rising wages, lower unemployment and tax cuts have helped to put more money into the pockets of Americans this year, spurring more shopping. Target rivals like Walmart Inc WMT.N and Nordstrom Inc JWN.N have also benefited from rising sales.

Target has also been helped by the demise of weaker competitors in the past year, including Toys ‘R’ Us Inc and department store operator Bon Ton Store Inc. Roughly 4,000 stores in the United States have closed this year through Aug. 10, according to Coresight Research.

FILE PHOTO: A Target store is seen in the Brooklyn borough of New York, U.S., November 14, 2017. REUTERS/Brendan McDermid/File Photo

“Target hit the bulls-eye in Q2, with improvement across virtually every meaningful measure,” said Moody’s retail analyst Charlie O’Shea.

Cornell said its performance was aided by investments in its online operations, bulking up its lineup of in-house brands, rolling out smaller stores, a supply chain overhaul, store remodeling and delivery options.

Online sales jumped 41 percent in the quarter, versus a 28 percent gain in the first quarter and a 32 percent rise a year ago after Target cut its next-day delivery fee for household items to $2.99 from $4.99 and rolled out a drive-up service to pick up orders in an hour.

Target is also expanding its delivery services through Shipt, a same-day delivery company it bought for $550 million last year, and partnering with courier services on same-day orders in U.S. metro areas. The retailer said it will offer same-day delivery to about two-thirds of U.S. households by the holiday season.

Target plans to make capital expenditure of $3 billion this year on its supply chain, online delivery, its own brands and merging online and in-store shopping. The retailer intends to reinvest more than $7 billion through 2020.

The retailer will try to grab more toy sales during the second half. “We are going to make sure we are taking more than our fair share of that market,” Cornell said referring to the toy and baby categories. Retailer Toys “R” Us Inc went bankrupt earlier this year.

Second-quarter same-store sales rose 4.9 percent, topping analysts’ expectations of a 3.99 percent increase, according to Thomson Reuters I/B/E/S.

Excluding one-time items, Target earned $1.47 per share in the quarter ended Aug. 4, higher than the average analyst estimate of $1.40.

Margins remained under pressure from investments in e-commerce. The gross margin rate was 30.3 percent, compared with 30.4 percent a year ago.

Revenue rose to $17.78 billion, topping the average estimate of $17.31 billion.

For the full year, Target raised its earnings forecast to a range of $5.30 to $5.50 per share from $5.15 to $5.45.

The retailer’s shares rose as much as 6.8 percent to $88.89, the highest since at least 1980, and were up 5.2 percent at $87.59 at midmorning.

Target’s shares have risen more than 27 percent so far in 2018 and over 47 percent in the past 12 months.