Consumer prices in the metropolitan area rose in October — at the fastest annual rate in two years — on higher costs for medical care and residential rent.

The federal Bureau of Labor Statistics reported Thursday its consumer price index for the 31-county region that includes Long Island rose 1.2 percent last month compared with October 2015.

It was the largest year-over-year increase in the index since October 2014.

The cost of health care jumped 4 percent last month compared with a year ago.

Residential rents were up 2.8 percent, year over year.

These increases were partially offset by price declines for some categories of food and energy.

advertisement | advertise on newsday

The cost of groceries fell 3 percent in October compared with a year earlier. Electricity prices were down 0.8 percent and clothing prices were off 1.4 percent, year over year, respectively.

The cost of gasoline, which has consistently fallen in recent years, was up 0.6 percent last month compared with October 2015.

Natural gas prices climbed 0.7 percent, year over year.