The Toronto Stock Exchange's S&P/TSX composite index closed down 3.07 points, or 0.02 percent, at 16,073.58.

Intraday gains for the index stalled just below its all-time high of 16,131.79 on Nov. 7.

The telecommunications group fell 0.8 percent, while industrials dipped 0.2 percent as Ritchie Bros. Auctioneers Inc retreated 2.7 percent to C$32.46.

Five of the index's 10 main groups were in negative territory.

The energy group, which accounts for almost a fifth of the index's weight, climbed 0.4 percent as U.S. crude prices reached $58 for the first time since July 2015.

U.S. crude oil futures settled up 2.1 percent at $58.02 a barrel.

The largest percentage gainer on the TSX was NexGen Energy Ltd, which rose nearly 8 percent to C$3.38.

The move higher for oil was in part due to TransCanada Corp cutting crude flows from Canada into the United States. TransCanada fell nearly 2 percent to C$62.99.

The materials group, which includes precious and base metals miners and fertilizer companies, added 0.5 percent.

Gold prices rose as the dollar fell on technical factors and weak U.S. economic data, and gold jumped more after the U.S. Federal Reserve released minutes of its latest meeting.

(Reporting by Fergal Smith and Alastair Sharp; Editing by Susan Thomas and Cynthia Osterman)