WASHINGTON?U.S. consumer prices increased in October from a year earlier at the fastest rate in two years, 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. Excluding the volatile costs of food and energy, so-called core prices rose 0.1%.

Economists surveyed by The Wall Street Journal had projected overall prices to rise 0.4% and core prices to increase 0.2%.

Higher prices for gasoline and shelter drove the gain.

Compared with a year earlier, overall prices grew 1.6% in October. Core prices grew 2.1% from a year earlier.

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.

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 to support to officials advocating for a rate increase at their meeting next month.

"The discussion of when is the appropriate moment for raising rates in order to prevent the economy from overheating too much?is now from my point of view?more on the table than it may have been before," Federal Reserve governor Daniel Tarullo said Tuesday at The Wall Street Journal's CEO Council.

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.

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 and Anna Louie Sussman at anna.sussman@wsj.com

(END) Dow Jones Newswires

November 17, 2016 08:55 ET (13:55 GMT)

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