* TSX ends down 5.14 points at 21,525.93

* Tech falls 2.8%; Shopify hits a 2-month low

* Materials group rises; gold posts record high

* Energy gains 1%

March 5 (Reuters) - Canada's main index ended lower on Tuesday as losses for the technology sector offset gains for resource shares after the price of gold moved to a record high, and as investors awaited an interest rate decision this week from the Bank of Canada.

The Toronto Stock Exchange's S&P/TSX composite index ended down 5.14 points at 21,525.93. It was the second straight day of modest losses for the index after notching a near two-year high on Friday.

Wall Street's major index posted heavier declines, with weakness in megacap growth shares weighing on the technology-heavy Nasdaq.

The Toronto market's technology sector fell 2.8%, with e-commerce company Shopify hitting a two-month low.

The Bank of Canada is expected on Wednesday to leave its benchmark interest rate on hold at a 22-year high. Investors were also awaiting congressional testimony from U.S. Federal Reserve Chair Jerome Powell and U.S. jobs data this week.

"It would be shocking to the markets if they (the BoC) cut (on Wednesday) as opposed to hold," said Macan Nia, co-chief investment strategist at Manulife Investment Management. "Central banks are going to be very methodical in terms of cutting interest rates, especially when inflation is still above their targets."

The materials sector, which includes precious and base metals miners and fertilizer companies, was up 0.3% as gold climbed as high as $2,141.59 per ounce.

Energy shares also gained ground, rising 1%, even as the price of oil settled 0.8% lower at $78.15 a barrel. (Reporting by Fergal Smith in Toronto and Purvi Agarwal in Bengaluru; Editing by Shilpi Majumdar, Will Dunham and Tasim Zahid)