Canada's main stock market posted its largest daily gain in more than two months on Tuesday as trade optimism produced a relief rally.

There is anecdotal evidence from the United States and Canada that they are closer to some sort of deal even though there is no concrete evidence, said Sid Mokhtari with CIBC Capital Markets.

"The market does have some element of optimism for maybe the U.S. is going to have cooler heads and be able to come to some sort of resolution with Canada in particular, some sort of a NAFTA deal," he said in an interview.

Foreign Affairs Minister Chrystia Freeland travelled to Washington to resume efforts to forge a new version of the continental trade pact.

Mokhtari figures the TSX could gain three to five per cent if a deal is reached.

The two sides are approaching a deadline this week to have a deal signed by the Mexican president before he leaves office. There are some signals from Canada, however, that a deal may take longer, which prompted a congressional ally of U.S. President Donald Trump to suggest that Canada was dragging out the talks for its own political purposes.

The S&P/TSX composite index closed up 113.73 points to 16,196.04, the largest daily gain since July 12. The index reached a high of 16,198.67 on 228.9 million shares traded.

The important energy sector rose 2.6 per cent as the November crude contract was up 91 cents to US$69.59 per barrel, its highest level in two weeks.

American stock markets also rose.

In New York, the Dow Jones industrial average was up 184.84 points to 26,246.96. The S&P 500 index was up 15.51 points to 2,904.31, while the Nasdaq composite was up 60.35 points at 7,956.11.

Investors appeared unfazed by China's move to increase tariffs on US$60 billion worth of U.S. goods, in retaliation to the U.S. saying it will impose tariffs on an additional US$200 billion of Chinese goods starting next Monday.

"We're getting a lot of zigzagging behaviour between offence and defence," said Mokharti. "Today is more of an offence tone for as yesterday and last week we did have more of a defensive tone."

Semi-conductor companies have historically been a good leading indicator for weakness in the technology sector, which is a very large part of the U.S. benchmark index. As it comes under pressure, the S&P 500 may feel it too, he added.

The Canadian dollar traded at an average of 76.97 cents US compared with an average of 76.81 cents US on Monday.

The October natural gas contract was up 11.9 cents at US$2.93 per mmBTU.

The December gold contract was down US$2.90 at US$1,202.90 an ounce and the December copper contract was up 7.95 cents at US$2.73 a pound.