Consumer prices in the metropolitan area rose last month compared with a year ago on higher costs for residential rents and gasoline.

The federal Bureau of Labor Statistics reported Friday that its consumer price index for the 31-county region that includes Long Island climbed 2 percent in April compared with April 2016.

It was the smallest such increase since December when the index began rising more than 2 percent per month, year over year.

The cost of housing was a key factor behind the most recent increase, said Martin Kohli, the bureau’s chief regional economist. Last month, residential rents climbed 2.5 percent from a year earlier, he said.

In addition, the cost of gasoline continued to rise, up 16.8 percent from April 2016.

advertisement | advertise on newsday

Medical care and recreation increased 2.8 percent and 3.5 percent, respectively, year over year.

Natural gas prices rose 12.1 percent last month compared with a year earlier.

These increases were partially offset by the cost of groceries and electricity declining 0.2 percent and 1.6 percent, respectively, year over year.

advertisement | advertise on newsday

The cost of furnishing and maintaining a home fell 2.1 percent last month compared with April 2016.