OTTAWA -- A rise in the Canadian dollar that helped keep food prices in check and a drop in fuel prices compared with a year ago helped cool the annual inflation rate last month.

Statistics Canada said Friday that the consumer price index for May was up 1.5 per cent from a year ago compared with a 1.7 per cent year-over-year increase in April.

Economists had expected an increase of 1.6 per cent, according to Thomson Reuters.

Bank of Montreal chief economist Doug Porter said the loonie's rebound helped dampen food inflation in particular, as the rise in grocery prices was relatively tame compared with increases earlier this year.

"Just as an example of how quick the turn has been, fresh veggies have gone from increases of more than 18 per cent early this year to less than two per cent now," Porter wrote in a note to clients.

The Canadian dollar dropped below 70 cents U.S. in January, but has gained ground since then.

Food prices saw their smallest year-over-year gain last month since March 2014. Food climbed 1.8 per cent compared with a gain of 3.2 per cent in April. The increase in prices of fresh vegetables and fruits saw considerable deceleration with a gain of 4.9 per cent compared with 11 per cent in April.

The price tag on apples, however, climbed 17.8 per cent last month compared with a year ago. Over the same period, alcohol and tobacco products were up 3.2 per cent.

Meanwhile, gasoline prices were down 7.1 per cent last month compared with May 2015. Excluding gasoline, last month's inflation rate was 1.9 per cent.

The annual core inflation rate, which excludes some of the most volatile items such as gasoline prices and some food, was 2.1 per cent last month after a 2.2 per cent reading in April.

CIBC economist Nick Exarhos noted that core inflation has been resilient despite the higher dollar.

"We're seeing a bit more strength than we'd expect given that the pass through from the Canadian dollar which has been lifting that more selective measure should be fading slowly," he said.

"So it suggests that underlying inflation pressures in Canada are a bit stronger than we would have expected given that the economy has slowed."

Exarhos said heading into the end of the year, higher oil prices could mean a pickup in inflation.

"As we head into 2017 we think that there's scope for gasoline prices to be a lift to overall inflation, especially since we expect crude oil to end the year a little bit higher than we are right now," he said.

Inflation was lower in eight provinces in May compared with the previous month. Only Manitoba saw a higher rate while Alberta's inflation rate was unchanged.

Here's what happened in the provinces and territories. (Previous month in brackets):

Newfoundland and Labrador: 1.5 per cent (2.0)

Prince Edward Island: 1.3 (1.7)

Nova Scotia: 1.1 (1.2)

New Brunswick: 1.6 (2.2)

Quebec: 0.7 (1.0)

Ontario: 1.9 (2.1)

Manitoba: 1.7 (1.3)

Saskatchewan: 1.2 (1.4)

Alberta: 1.5 (1.5)

British Columbia: 1.7 (1.8)

Whitehorse, Yukon: 0.6 (0.7)

Yellowknife, N.W.T.: 1.0 (1.6)

Iqaluit, Nunavut: 2.2 (2.3)

The agency also released rates for major cities, but cautioned that figures may fluctuate widely because they are based on small statistical samples (Previous month in brackets):