Consumer prices in the metropolitan area increased modestly last month compared with a year earlier on higher residential rents.

The federal Bureau of Labor Statistics on Thursday said its consumer price index for the 31-county region that includes Long Island were 0.9 percent higher in May than the same month last year.

The gain was primarily due to higher housing costs, which offset price declines for groceries and gasoline, said Martin Kohli, the bureau’s chief regional economist.

Residential rents were up 3.8 percent last month compared with May 2015.

The cost of gasoline fell 15.5 percent, year over year, while electricity was down 6.2 percent.

advertisement | advertise on newsday

Prices for food were mixed, with the cost of groceries declining 1.5 percent last month compared with May 2015, while restaurant meals climbed 3.1 percent.

Clothing prices dropped 1.1 percent and furniture and other household furnishing were down 1.6 percent.

The cost of medical care rose 2.3 percent, year over year.