Consumer prices in the metropolitan area rose last month at their fastest rate in nearly five years on higher costs for housing and energy.

The federal Bureau of Labor Statistics reported Wednesday that its consumer price index for the 31-county region that includes Long Island rose 2.5 percent in January from the level in January 2016.

That is the largest year-over-year increase in the index since March 2012, when the index rose 2.6 percent.

The January year-over-year gain follows a large increase in December. The figures are not seasonally adjusted.

In January, residential rents were up 2.6 percent, year over year.

The cost of gasoline climbed 25.8 percent from January 2016. Pump prices have been rising recently after steady declines for more than a year.

advertisement | advertise on newsday

Natural gas prices also continue to increase, and were up 18.7 percent last month compared with January 2016. It was the largest year-over-year gain in nearly 11 years.

The cost of health care jumped 5 percent in January from a year ago.

These increases were partially offset by falling grocery and electricity prices.

The cost of groceries fell 1.9 percent in January from a year earlier. Electricity prices were down 0.5 percent.

Nationally, the bureau’s price index also rose 2.5 percent last month compared with January 2016. It was the highest year-over-year growth rate in nearly five years. The figures are not seasonally adjusted.

The national gain was driven by increases in the cost of gasoline and fuel oil, among others.

Chris G. Christopher Jr., an economist with the forecasting firm IHS Global Insight in Lexington, Massachusetts, said poor consumers, in particular, will be hit hard by rising prices.

“It is obvious that consumer prices have gained momentum in recent months,” he said. “This is not the best thing in the world for lower income households living paycheck to paycheck.”

Christopher also said Wednesday’s consumer prices report could spur the Federal Reserve’s interest-rate-setting committee to increase short-term rates next month. He said, the “CPI report increases the chances of a March hike.”