Canada’s rate of inflation accelerated by more than expected for the second straight month, but the gains that are largely driven by higher gasoline prices may allow the Bank of Canada to look past the setback.

The consumer price index rose four per cent in August from a year ago, the quickest pace since April, following a 3.3 per cent increase in July, Statistics Canada reported Tuesday in Ottawa. That’s faster than the median estimate of 3.8 per cent in a Bloomberg survey of economists. On a monthly basis, the index rose 0.4 per cent, double the expectations.

Two key yearly inflation measures that filter out index components with extreme price fluctuations and are tracked closely by the central bank — the so-called trim and median core rates — also increased, averaging four per cent from an upwardly revised 3.75 per cent a month earlier, exceeding the 3.7 per cent pace expected by economists.

A three-month moving average of the measures that Governor Tiff Macklem has flagged as key to his team’s thinking rose by a full percentage point to an annualized pace of 4.49 per cent, according to Bloomberg calculations.

Traders in overnight swaps upped bets the central bank will resume tightening — odds of another rate hike rose to about a coin flip, from over a third before the release. Bonds were pummeled, with the Canada two-year yield jumping to 4.862 per cent as of 8:44 a.m. Ottawa time — the highest since July.

Tuesday’s numbers once again highlight a challenge in the current phase of the inflation battle, where the decline toward the 2 per cent target is expected to be more uncertain. The bank forecast price gains would remain near 3 per cent for the next year. But with the economy showing signs of softening, policymakers may be willing to wait for disinflationary forces to translate into a slower rate of inflation in the coming months.

Macklem alluded to the acceleration in his speech earlier this month after holding rates steady at five per cent for two straight hikes, saying that higher global oil prices would “increase headline inflation in the near term.” Energy prices had been the biggest contributor to slowing inflation since the peak last year, accounting for two-thirds of the slowdown.

In the U.S., the jump in gasoline prices also led to an acceleration in core inflation for the first time in six months.

This is the first of two inflation reports before the Bank of Canada’s next rate decision on Oct. 25, when the majority of economists in a Bloomberg survey expect Macklem and his officials to hold borrowing costs steady at five per cent.

Over the past several weeks in Canada, evidence is mounting that interest rate increases are slowing down the economy. The labor market added fewer jobs than the gains in employment from immigration-driven population growth in August, while preliminary data suggested gross domestic product was flat in July, after a surprise contraction in the second quarter.

The bank will have some tough decisions to make at upcoming meetings, said Andrew Grantham, an economist with the Canadian Imperial Bank of Commerce.

“While the stall in the economy in Q2 and modest rise in the unemployment rate are indicators that excess demand is diminishing, which should give policymakers comfort that inflation will come down in the future, they will need to balance that against evidence that current inflationary pressures remain stronger than previously anticipated,” he said in a report to investors.

Also on Tuesday, Statistics Canada reported that the job vacancy rate — or the number of vacant positions as a proportion of total labor demand — reached 4.4 per cent in the second quarter, the fourth consecutive quarterly decline.

The acceleration in headline inflation was largely the result of higher year-over-year prices for gasoline in August compared with July. Excluding gasoline, the index held steady at 4.1 per cent in July and August.

Gasoline prices rose 0.8 per cent on the year in August, the first increase since January, after falling 12.9 per cent in July. On a monthly basis, gasoline prices rose 4.6 per cent, mainly the result of higher crude prices following production cuts from major oil-producing countries.

Shelter prices were up sixe per cent in August compared with a year earlier, after increasing 5.1 per cent in July. Faster growth in shelter prices was led by the rent index, which rose 6.5 per cent after a 5.5 per cent gain in July, as a higher interest-rate environment raised barriers to homeownership.

The mortgage interest cost index also contributed to the acceleration in shelter prices, rising at 30.9 per cent in August compared with 30.6 per cent in July.

Price growth for groceries slowed in August. On a year-over-year basis, prices for food purchased from stores rose 6.9 per cent in August compared with 8.5 per cent in July. On a monthly basis, prices for groceries were down 0.4 per cent last month.

In August, services inflation held steady at 4.3 per cent.

Regionally, prices rose at a faster year-over-year pace in August compared with July in every province.

Energy prices increased the most in Alberta, jumping 13.3 per cent in August from a year ago, with gasoline, natural and electricity prices contributing to the acceleration amid high demand.

Rent prices accelerated in eight provinces, with Newfoundland and Labrador, Alberta, Nova Scotia and Manitoba seeing the fastest price growth.

With assistance from Erik Hertzberg.