By Eric Morath

WASHINGTON -- U.S. consumer-price gains accelerated in October for the third-straight month largely due to rising energy costs, the latest sign inflation pressures in the economy are firming.

The consumer-price index, measuring what Americans pay for everything from rent to razors, advanced a seasonally adjusted 0.4% from a month earlier, the Labor Department said Thursday. But when excluding the volatile costs of food and energy, so-called core prices rose a milder 0.1%.

Higher prices for gasoline, electrical utilities and shelter drove the gain, despite flat costs for medical services and food.

Compared with a year earlier, overall prices grew 1.6% in October, the strongest gain in two years. Core prices grew 2.1% from a year earlier, a slight deceleration from the prior two months.

The "report provided further confirmation of strong energy base effects boosting headline CPI," said Barclays economist Blerina Uruçi. "Although core inflation rose less than expected, we still believe that domestic price pressures remain strong."

Consumer prices increased in seven of the past eight months and those gains have accelerated since the summer. The advances lifted the inflation gauge from essentially flat a year ago to a rate of increase that is more consistent with a steadily growing economy.

Inflation has been mostly subdued for the past several years, largely due to falling energy prices, an effect that is now fading. Economists view weak inflation as a symptom of a sluggish economy without enough demand or income gains to allow firms to command higher prices.

The CPI report showed energy prices in October rose 3.5%. Gasoline costs were up 7%, but down 0.9% from a year earlier.

Shelter costs, which account for a third of the index, rose 0.4% last month, and were up 3.5% from a year earlier.

Food prices were flat for the fourth straight month in October. The cost of medical services were flat.

Federal Reserve policy makers target 2% annual price increases as a healthy level that is neither too weak nor a sign of an overheating economy.

The target hasn't been achieved for more than four years, as measured by the Fed's preferred inflation gauge, the Commerce Department's personal-consumption expenditures price index. That reading rose 1.2% from a year earlier in September, the strongest increase since November 2014. The Commerce Department will release its October inflation measure at the end of this month.

Weak inflation has been one factor holding back the Fed from raising its benchmark interest rate since December 2015. A firmer pace of inflation in recent months could offer support to officials advocating for a rate increase at their meeting next month.

Fed Chairwoman Janet Yellen cited stronger inflation readings when telling members of Congress on Thursday that the case for a rate increase has "strengthened."

"As the labor market strengthens further and the transitory influences holding down inflation fade, I expect inflation to rise to 2%," she said in written testimony released Thursday morning.

Separately Thursday, data showed workers' earnings were flat in October from September, when adjusting for inflation. Stronger inflation offset the increase hourly wages, and the average workweek was unchanged.

Write to Eric Morath at eric.morath@wsj.com

(END) Dow Jones Newswires

November 17, 2016 11:01 ET (16:01 GMT)

Copyright (c) 2016 Dow Jones & Company, Inc.