TORONTO -- Three of North America's stock markets closed at all-time highs Tuesday after getting lifts from strong U.S. corporate results and higher crude oil prices.

Canada's main stock market, the S&P 500 and the Nasdaq composite all set new highs.

"The earnings are coming in higher than expectations and therefore I think it's creating a bit of confidence, so I think that's part of what's going on," said Dominique Barker, portfolio manager at CIBC Asset Management.

The S&P/TSX composite index closed up 92.12 points at 16,669.40, after reaching an intraday high of 16,672.71. The records came a day after closing at its highest point since last July.

Energy led the way, gaining 1.44 per cent on higher crude oil prices. Telecommunications lost ground as just three of the 11 main sectors were up on the day.

The June crude contract was up 75 cents at US$66.30 per barrel and the June natural gas contract down 5.9 cents at US$2.50 per mmBTU.

Oil prices rose for a second day following the Trump administration's announcement that buyers of Iranian oil must stop purchases by May 1 or face sanctions.

The big winners were Encana Corp., Imperial Oil, Canadian Natural Resources, Enbridge Inc. and Suncor Energy Inc.

The gain by Suncor is particularly newsworthy because it is the go-to name for foreign money, said Barker.

"So that may be an indication that we've got foreign non-Canadian money going into the Canadian market finally," she said in an interview.

"We've been anticipating that for some time. It's been surprising how Canadian energy companies have been largely ignored by the world and have been trading at very depressed valuation multiples versus peers and so potentially this is the start of something more significant."

In New York, the Dow Jones industrial average was up 145.34 points at 26,656.39. The S&P 500 index closed up 25.71 points to 2,933.68, after reaching a high of 2,936.31 earlier in the session. Those are the highest levels since Sept. 20. The Nasdaq composite was up 105.56 points at 8,120.82 after reaching 8,128.87 in intraday trading.

U.S. markets gained on a variety of corporate results that beat expectations and defied analyst pessimism heading into the first quarter.

"Those are pretty good indicators of a strong economy and they're also large parts of the index," added Barker.

The Canadian dollar traded at an average of 74.51 cents US compared with an average of 74.89 cents US on Monday.

The June gold contract was down US$4.40 at US$1,273.20 an ounce and the May copper contract was down 0.8 of a cent at US$2.89 a pound.

Despite the new record highs, Barker says she's cautious about the future market trajectories given that many of the global risks, including Brexit and China-U.S. trade, have subsided.

"But these are the type of things that can come back fairly violently so I am cautious."