TORONTO, Jan 5 (Reuters) - Canada's main stock index rose to a record high on Monday as gains for financial and metal mining shares overshadowed losses for energy stocks following turmoil in Venezuela.

The S&P/TSX Composite Index ended up 336.58 points or 1.1% at 32,219.95, eclipsing the record closing high from December 23.

"Nothing can stop the freight train that is the TSX. It just seems to have all the right allocations for today's market," said Barry Schwartz, chief investment officer at Baskin Wealth Management.

"Gold's a driver today, the banks are unstoppable ... there's no better place to be when stock markets are at record highs than financial stocks."

Heavily weighted financials added 1.6%, while the materials group, which includes metal mining shares, ended 3.3% higher after U.S. strikes in Venezuela added to gold's safe-haven appeal. The precious metal was up 2.7%.

Shares of e-commerce company Shopify Inc were up nearly 6%, which helped lift the technology sector by 0.8%.

The energy sector fell 3.6%, with Canadian Natural Resources Ltd down 6%, but finished well above its low for the day. The price of oil settled 1.7% higher at $58.32 a barrel.

"The worry is that there will be all this oil flowing out of Venezuela and the U.S. won't need the Canadian supply," Schwartz said. 

"The truth is ... you can't flip the switch and replace the Canadian oil overnight. It's going to take at least a decade and in the meantime oil demand increases every year."

(Reporting by Fergal Smith in Toronto and Utkarsh Tushar Hathi; Editing by Jonathan Ananda and Matthew Lewis)

By Fergal Smith