U.S. producer prices in May recorded their biggest increase in more than 2-1/2 years as the cost of gasoline and food rose, suggesting that an oil-driven downward drift in prices was nearing an end.

The stabilization in producer prices should support views that the Federal Reserve will raise interest rates this year. While the labor market has tightened, there have been few clear signs that inflation was poised to rise back toward the Fed's 2 percent target.

"This report essentially confirms that the disinflationary impulse in headline prices, which has been brought about by the collapse in energy prices, is beginning to abate as crude prices shift higher," said Millan Mulraine, deputy chief economist at TD Securities in New York.

The Labor Department said on Friday its producer price index for final demand increased 0.5 percent last month, the largest gain since September 2012. That followed a 0.4 percent decline in April.

In the year to May, the PPI fell 1.1 percent, marking the fourth straight 12-month decrease. Prices dropped 1.3 percent in the 12 months through April, the biggest fall since 2010.

Prices of U.S. government debt were largely unchanged after the data, while the dollar pared gains against a basket of currencies. U.S. stock index futures were trading lower.

A sharp decline in crude oil prices since last year and a strong dollar have weighed on producer prices. While rising oil prices are easing some of the downward pressure on inflation, the upward trend in producer prices is likely to be gradual because of the dollar's strength.

The greenback has gained about 13.2 percent against the currencies of the United States' main trading partners since June 2014.

Last month, gasoline prices surged 17 percent, the largest increase since August 2009. Food prices rose 0.8 percent in May, the biggest gain in just over a year, snapping five straight months of declines.

Higher food prices were driven by a shortage of eggs after an outbreak of bird flu led to the culling of millions of chickens. Wholesale egg prices soared a record 56.4 percent last month.

While the spillover from producer prices to consumer prices has weakened, higher gasoline and food prices are likely to feed into the May consumer price index. May consumer price data will be published next week.

The volatile trade services component, which mostly reflects profit margins at retailers and wholesalers, increased 0.6 percent in May after falling 0.8 percent in the prior month.

May's rise likely reflects improving profit margins at services station, which had been pressured by falling gasoline prices.

A key measure of underlying producer price pressures that excludes food, energy and trade services dipped 0.1 percent last month after ticking up 0.1 percent in April. The so-called core PPI was up 0.6 percent in the 12 months through May.

The cost of airline passenger services, a proxy for airline fares, fell 0.4 percent in May after being flat in April.

Physician care costs nudged up 0.1 percent after slipping 0.3 percent in April. This component feeds into the personal consumption expenditures (PCE) price index, which is the Fed's preferred inflation measure. 

By Lucia Mutikani - Reuters (Editing by Paul Simao)