OTTAWA - Canada's annual inflation rate unexpectedly accelerated to 7.7% in May, the highest since January 1983, largely driven by higher gasoline prices, Statistics Canada data showed on Wednesday.

The rate of price increases galloped past April's 6.8% and beat analyst predictions of 7.4%. The month-over-month gain of 1.4%, driven again by high gasoline prices, was also ahead of forecast.

Prices rose more in May than in April in every province, led by higher prices at the pump and bolstered by higher services costs. Excluding gasoline, the annual rate rose 6.3%, up from 5.8% in April, Statscan said.

"Price pressures continued to be broad-based, pinching the pocketbooks of Canadians and in some cases affecting their ability to meet day-to-day expenses," Statscan said.

Energy prices rose 34.8% on an annual basis, with consumers paying 48.0% more for gasoline. Grocery price gains matched April's increase at 9.7% and shelter cost inflation also matched April at 7.4%. Prices for services rose more in May than in April, led by hotels and food in restaurants.

CPI common, which the central bank says is the best gauge of the economy's performance, hit 3.9%, beating forecasts of 3.5% and matching a July 1991 high. CPI median and trim, at 4.9% and 5.4% respectively, were the highest on record.

The Bank of Canada hiked interest rates to 1.5% from 1.0% this month and said it was ready to act "more forcefully" if needed to tame inflation. The Canadian dollar was trading down 0.4% at 1.2970 to the greenback or 77.10 U.S. cents.

(Reporting by Julie Gordon in Ottawa, Additional reporting by Dale Smith in Ottawa and Fergal Smith in Toronto, Editing by Mark Potter)