A sign board displaying Toronto Stock Exchange (TSX) stock information is seen in Toronto June 23, 2014.
A sign board displaying Toronto Stock Exchange (TSX) stock information is seen in Toronto June 23, 2014. Reuters / Mark Blinch

Canada's main stock index edged higher on Friday, adding to this week's gains, as rising concern that Russia could invade Ukraine sent oil and gold prices sharply higher.

The Toronto Stock Exchange's S&P/TSX composite index ended up 17.12 points, or 0.1%, at 21,548.84. For the week, it was up 1.3%, its third straight weekly advance.

In contrast, Wall Street stocks fell sharply for a second day as investors fretted about potential steep U.S. interest rate hikes and Washington warned that Russia was massing more troops near Ukraine and that an invasion could come at any time.

"Everyone is looking for places to go to hide," said Greg Taylor, portfolio manager at Purpose Investments. "Toronto is looking like a pretty good situation with energy up a lot ... and then today we've got the golds kicking in."

The energy sector advanced 3.6% as escalating Ukraine tensions added to concern about tight supply in the oil market. U.S. crude oil futures settled 3.6% higher at $93.10 a barrel.

The materials group, which includes precious and base metals miners and fertilizer companies, was up 3.4% as gold attracted safe-haven demand. It touched its highest level in nearly three months at $1,865.15 per ounce.

Auto parts maker Magna International fell 6.4% after the company said that disruptions at the Ambassador bridge caused by Canadian trucker protests against coronavirus mandates have started to have some initial impact on its operations.

Consumer discretionary shares lost 3.2% and technology ended 2.8% lower.