TORONTO (Reuters) - Canada's main stock index climbed on Wednesday on gains in the energy sector as the price of oil rallied and in BlackBerry (>> BlackBerry Ltd) after the smartphone maker announced plans to divest some real estate holdings.

Oil benefited as TransCanada Corp (>> TransCanada Corporation) opened a new pipeline from Oklahoma to the Gulf Coast, commissioning the $2.3 billion project that is expected to help eliminate a bottleneck that has warped the U.S. oil market for three years. The move helped drive TransCanada shares higher.

Investors took note of the Bank of Canada's announcement that it would leave its main overnight rate unchanged. The central bank said it was more concerned about weak inflation than it was three months ago and stated that its next move on interest rates could be either down or up, depending on economic data.

The Toronto Stock Exchange's benchmark index, which has gained in six of the last seven trading sessions, is up about 2.7 percent this year.

"The mood out there is upbeat. People are busy, and money is being put to work in an orderly fashion," said Diana Avigdor, portfolio manager and head of trading at Barometer Capital Management.

"This is a good, robust market since the beginning of the year," she said.

The S&P/TSX composite index <.GSPTSE> closed up 36.43 points, or 0.26 percent, at 13,988.20.

"Clearly we're seeing a bit more confidence from domestic investors," said Craig Fehr, Canadian market strategist at investment firm Edward Jones in St. Louis, Missouri. "The equity investment environment continues to be relatively favorable."

Seven of the 10 main sectors on the index were higher.

Financials, the index's most heavily weighted sector, added 0.3 percent, with Royal Bank of Canada (>> Royal Bank of Canada) climbing 0.3 percent to C$73.18, and Bank of Montreal (>> Bank of Montreal) rising 0.4 percent to C$73.02.

Energy shares climbed 0.7 percent. Suncor Energy Inc (>> Suncor Energy Inc.) advanced 1.3 percent to C$37.99, and TransCanada was up 0.8 percent at C$48.84.

Providing further support was BlackBerry, whose shares jumped 9.9 percent to C$11.96, a day after the smartphone maker said it planned to divest the majority of its Canadian real estate holdings.

But gold mining shares gave back 1.7 percent. Barrick Gold Corp (>> Barrick Gold Corp.) declined 1.3 percent to C$20.81, and Goldcorp Inc (>> Goldcorp Inc.) slipped 0.9 percent to C$25.63.

(Editing by Jonathan Oatis; and Peter Galloway)

By John Tilak