Consumer prices in the metropolitan area rose last month at one of the fastest rates in five years on higher costs for gasoline, medical care and residential rents.

The federal Bureau of Labor Statistics reported yesterday its consumer price index for the 31-county region that includes Long Island and New York City climbed 2.3 percent in March from a year earlier.

It was the largest such increase in five years with the exception of January and February, when the index was up 2.5 percent and 2.6 percent, respectively, year over year.

The cost of gasoline has been a key factor behind the recent increases. Last month, pump prices rose 27.4 percent compared with March 2016.

The cost of medical care climbed 4.2 percent, year over year, while residential rents were up 2.5 percent.

Natural gas prices rose 11.2 percent in March compared with a year earlier.

advertisement | advertise on newsday

These increases were partially offset by the cost of electricity, which declined 0.7 percent year over year.

Nationwide, the price index was up 2.4 percent last month compared with March 2016 due in part to higher costs of gasoline and home heating oil.

Heating oil rose 24.9 percent across the country last month compared with a year earlier, while gasoline was up 19.9 percent.

Nationally, the cost of groceries and used automobiles fell 0.9 percent and 4.7 percent, respectively, between March 2016 and last month.

Michael Montgomery, U.S. economist for economic forecasting firm IHS Markit, said, “Consumer prices are edging higher; core goods [excluding food and energy] will nudge up over the next few quarters.”