* TSX ends down 0.4% at 20,872.14

* Financials, technology stocks drag

* Canadian factory activity slumps in December

Jan 2 (Reuters) - Canada's main stock index posted a decline in the first trading day of 2024, weighed by losses for technology and financial shares, as a rebound in long-term borrowing costs rattled investors.

The Toronto Stock Exchange's S&P/TSX composite index ended the Tuesday session down 86.3 points, or 0.4%, at 20,872.14.

U.S. benchmark the S&P 500 also fell as U.S. Treasury yields clawed back some of the big downward move seen since November.

"(We are) looking for a bit of choppy January as we had a pretty big move in bond yields higher and we'll see if that sets the tone for the year," said Greg Taylor, chief investment officer at Purpose Investments.

The TSX gained more than 8% in 2023 as optimism that the U.S. Federal Reserve and the Bank of Canada will soon start cutting interest rates offset the potential for slower economic growth.

Canada's factory sector contracted in December at its steepest pace since the early months of the COVID-19 pandemic as the rising cost of manufactured goods crimped demand, data showed.

The technology sector fell 2.8%, with shares of e-commerce company Shopify Inc down 4.6%. Health care lost 1.5% and heavily-weighted financials ended 0.6% lower.

In a tough year for Canadian banks, shares in mid-sized lender EQB Inc jumped more than 50% on solid earnings growth, making it the best-performing banking stock in 2023, with investors expecting more gains this year.

Energy was a bright spot, rising 0.5%, even as the price of oil settled 1.8% lower at $70.38 a barrel. (Reporting by Fergal Smith in Toronto and Amruta Khandekar and Purvi Agarwal in Bengaluru; Editing by Shweta Agarwal and Aurora Ellis)