(Reuters) -Canada's main stock index came within a whisker of erasing its decline since the start of the year on Thursday, with technology and mining shares leading gains as investors weighed prospects of U.S. trade deals and Federal Reserve interest rate cuts.

The Toronto Stock Exchange's S&P/TSX Composite Index ended up 254.85 points, or 1%, at 24,727.53, its highest closing level since April 2. At the end of 2024, it was at 24,727.94.

Better-than-expected U.S. corporate earnings, hopes that the U.S. is making progress on trade deals and the potential for a June interest rate cut from the Fed have driven improved investor sentiment, said Mike Archibald, a portfolio manager at AGF Investments.

A June rate cut would "help the liquidity of the market" and propel risk taking, Archibald said.

The Canadian 10-year yield eased 6 basis points to 3.189%, tracking moves in U.S. Treasury yields.

The Toronto market's technology sector rose 2.8%, with e-commerce company Shopify Inc adding 4.3%.

The materials group, which includes fertilizer companies and metal mining shares, ended 1.4% higher as gold and copper prices climbed.

Teck Resources Ltd reported first-quarter results that beat expectations due to higher commodity prices and copper sales volumes. Shares of the mining company were up 3.7%.

The price of oil also rose, settling 0.8% higher at $62.79 a barrel in a boost for energy. The sector advanced 1% and heavily weighted financials were up 0.8%.

Cargojet Inc was a standout. Its shares advanced 15.3% after the company beat earnings estimates.

In contrast, shares of Aecon Group Inc fell 9.8% after the construction company reported first-quarter results.

(Reporting by Fergal Smith in Toronto and Ragini Mathur in Bengaluru; Editing by Sahal Muhammed and Diane Craft)

By Fergal Smith