U.S. wholesale prices unexpectedly rose in June for the first time in four months, as higher food costs offset another big drop in energy prices.

The producer price index, which measures how much manufacturers and wholesalers pay for finished goods, rose 0.1 percent in June. Economists polled by Reuters had called for the gauge to drop 0.5 percent.

The gains in the PPI were driven by a 0.5 percent increase in food, reflecting the biggest increase in meat prices since July 2011.

With grain prices soaring in recent weeks we expect to see further sizeable increases in PPI finished food over the second half of the year, Paul Ashworth, chief U.S. economist at Capital Economics, wrote in a note to clients.

Meanwhile, energy prices fell 0.9 percent in June, dragged down by a record drop in prices for residential electric power, which fell 2.1 percent. Diesel fuel prices declined 8.8 percent.

The so-called core inflation, which strips out more volatile food and energy prices, rose 0.2 percent as projected.

Year over year, wholesale prices rose 0.7 percent, matching the 12-month gain in May as the smallest since October 2009.

Some Federal Reserve officials thought in June that the central bank would likely need to take more action to help the jobs market, while others thought that would only be justified if the economic recovery loses momentum or inflation drops, according to minutes of the Fed's last meeting released Wednesday.

With the annual rate of PPI inflation at only 0.7 percent last month, the Fed can focus on what's happening in the real economy, Ashworth said.