TORONTO -- Canada's main stock index closed at its highest level in six weeks on renewed hopes of a U.S.-China trade deal and diminished fears of a recession.

The S&P/TSX composite index gained 125.97 points to close at 16,574.81, its highest close since July 24 and less than 100 points off its record high.

U.S. markets also surged, outpacing the Toronto market because technology companies had a strong day after the world's two largest economies announced they would meet again next month in Washington, D.C.

"So investors are welcoming this reprieve today and risk assets are rallying broadly across both global equity markets but also commodities prices," said Candice Bangsund, portfolio manager for Fiera Capital.

Markets have rallied before only to have hopes dashed by a tweet.

It's encouraging that the two sides are continuing to talk and seem willing to come to a deal despite imposing increased tariffs last weekend, she said.

"The fact that they are getting together face-to-face, that has sparked speculation that there could be some sort of deal and obviously that's come as a relief for investors," Bangsund said in an interview.

"Our sense is that a deal will be done by year-end and this is a step in the right direction."

The positive trade sentiment followed a de-escalation in political instability in Hong Kong and in London as lawmakers moved to block a no-deal Brexit.

Strong U.S. economic also diminished fears of a recession.

Private payrolls increased by 195,000, exceeding expectations, ahead of Friday's monthly non-farm payrolls report. The U.S. services industry also had its fastest expansion last month since February, according to the Institute for Supply Management's non-manufacturing purchasing managers index (PMI).

"The numbers that we saw today really reinforced the fact that the U.S. economy remains in great shape and that fears of recession are largely misplaced," Bangsund said.

Strong economic data should prevent the Federal Reserve from cutting interest rates beyond 25 basis points in September, she added.

In New York, the Dow Jones industrial average ended up 372.68 points at 26,728.15. The S&P 500 index was up 38.22 points at 2,976.00, while the Nasdaq composite was up 139.95 points at 8,116.83.

The Canadian dollar traded for an average of 75.60 cents US compared with an average of 75.40 cents US on Wednesday.

Eight of the 11 major sectors on the TSX closed higher in a broad-based rally led by health care. It gained 3.7 per cent as Canopy Growth Inc. surged 7.4 per cent after outgoing CEO Mark Zekulin said the mood at the cannabis producer has "never been better," two months after co-founder Bruce Linton was ousted from the job.

Energy was up 2.65 per cent higher as Cenovus Energy Inc. climbed nearly five per cent. Crude oil prices rose early in the day on trade optimism but faded after a weekly report showed an increase in U.S. crude stockpiles. The October crude contract settled up four cents at US$56.30 per barrel and the October natural gas contract was down one cent at US$2.44 per mmBTU.

Technology and industrials were also stronger while the heavyweight financials sector rose 1.4 per cent led by IGM Financial Inc. and National Bank of Canada as bond yields moved higher.

Materials lost 2.5 per cent with Centerra Gold Inc. and First Majestic Silver Corp. falling more than nine per cent as gold fell from its six-year high. The December gold contract was down US$34.90 at US$1,525.50 an ounce and the December copper contract was up 4.7 cents at US$2.64 a pound.