OTTAWA -- The annual pace of inflation picked up in May as the consumer price index rose 2.4 per cent compared with a year ago, its largest increase since October last year, Statistics Canada said Wednesday.

The move compared with a 2.0 per cent increase in April and was the fourth straight month of rising year-over-year increases. Economists had expected an increase of 2.1 per cent for May, according to Thomson Reuters Eikon.

"Inflation is back in Canada, at least for now," said TD Bank Senior Economist James Marple, in a note to clients Wednesday.

"While some of the factors pushing up price growth are likely to prove fleeting, we can't discount the relatively broad-based nature of price growth in May.

"The Canadian economy continues to recover from its soft patch at the start of this year, with increasing signs of improving domestic demand, that should push growth above its potential rate over the remainder of this year."

Statistics Canada said prices rose in all eight of major components of the index compared with a year ago.

Food prices rose 3.5 per cent as fresh vegetable prices climbed 16.7 per cent, the largest year-over-year increase since February 2016.

Transportation prices gained 3.1 per cent as the cost of air transportation added 8.9 per cent and the cost of passenger vehicles rose 4.2 per cent. Passenger vehicle insurance premiums rose 8.1 per cent.

However, drivers paid 3.7 per cent less for gasoline compared with a year ago. Excluding gasoline, the consumer price index increased 2.7 per cent in May compared with a year ago. In April, the year-over-year increase was 2.3 per cent.

The rise in prices put inflation ahead of the Bank of Canada's ideal target for inflation of 2.0 per cent.

The Bank of Canada, which adjusts its key interest rate to keep inflation in check, has kept the rate at 1.75 per cent since October last year amid the economic weakness at the end of 2018 and the start of this year.

The central bank has been predicting the economy will pick up this year, however there has been mixed opinions among economists about what the Bank of Canada will do with its policy interest rate.

Many economists expect the U.S. Federal Reserve to cut interest rates later this year.

The Statistics Canada report said the average of its three gauges for core inflation, which are considered better measures of underlying price pressures because they omit volatile items like gasoline, rose to 2.07 per cent compared with 1.90 per cent in April.

"The pick up in underlying inflation, which continues to trend around the two per cent target, highlights how the BoC is facing quite a different policy picture than the Fed," said Benjamin Reitzes, Canadian rates and macro strategist at BMO Capital Markets.

Reitzes said the inflation report is one more reason for the Bank of Canada "to remain patient and resist the temptation to follow the parade of global central bankers sounding more dovish."

With files from BNN Bloomberg