June 7 (Reuters) - Canadian stocks pared gains on Wednesday after the country's central bank's surprise decision to raise its benchmark interest rates, while a boost from energy shares helped keep the main stock index afloat.

The Toronto Stock Exchange's S&P/TSX composite index was up 0.05%, after rising as much as 0.4% to 20,149.95 ahead of the rate decision.

The Bank of Canada (BoC) hiked the key rate to 4.75%, the highest level in 22 years, on increasing concerns that inflation could get stuck significantly above its 2% target.

"It was either now or in July that they probably needed to give a token 25 bps (hike)," said Diana Avigdor, portfolio manager and head of trading at Barometer Capital Management.

"The silver lining is that the economy is not falling apart, however, rate hikes play through the economy over 18 to 24 months and central bankers have to be careful and not look at today's data, but rather what can happen in the year or two."

Canadian money markets see a near-50% chance of another rate hike in July, fully pricing in further tightening by September.

Investors are now on the lookout for inflation data out of the U.S. and the Federal Reserve's policy meeting next week.

Energy stocks jumped 1.3%, tracking firm oil prices.

Materials stocks gained 0.8% as copper prices hit their highest level in nearly four weeks on hopes that China would inject more stimulus into its economy.

North West Company dropped 4.8% after the food retailer reported quarterly profit below market expectations, pulling consumer staples to the bottom of the sector indexes.

On the flipside, financials fell 0.4%. (Reporting by Ankika Biswas and Shashwat Chauhan in Bengaluru; Editing by Shilpi Majumdar)