Wholesale inflation posted a better-than-expected reading in June as both food and energy costs retreated.

The Labor Department said its Producer Price Index fell by 0.2 percent last month, the first decline since a 0.6 percent dip in January. Since that time, wholesale prices had been recording big gains, reflecting the fact that gasoline surged to record levels and food costs have been rising because of heavy demand for corn to use in ethanol.

But in June, food prices dropped by 0.8 percent and energy prices were down 1.1 percent.

Core inflation, which excludes volatile food and energy, rose by a higher than expected 0.3 percent in June although most of that increase reflected a jump in car prices. Without the increase in cars and light trucks, core inflation would have posted a much more moderate 0.1 percent rise.

Federal Reserve Chairman Ben Bernanke is scheduled to deliver the central bank's midyear economic forecast to Congress on Wednesday. Financial markets expect he will continue to signal that interest rates, which have not been changed for more than a year, will remain steady for perhaps the rest of this year.

The Fed continues to believe that the biggest risk to the economy is the threat of inflation but it has been content to watch to see whether the economic slowdown it has engineered will be enough to ease price pressures.

Through the first six months of this year, prices at the wholesale level have been rising at an annual rate of 6.4 percent, a sharp acceleration from a flat reading for the final six months of last year.

However, most of the rising price pressures reflected the spurt in energy costs, which eased a bit in June.

Gasoline prices, which hit a record of $3.227 in late May fell steadily in June and early July before edging up again in recent weeks over renewed concerns about production problems. However, that rebound is expected to be temporary as refineries get back to full production.

Gasoline prices at the wholesale level fell by 3.9 percent in June, the biggest drop since a 13 percent plunge in January. Overall energy costs were down 1.1 percent last month as electric power and liquefied petroleum gas both fell while natural gas prices rose.

Food prices also fell, dropping by 0.8 percent as the price of fruit, eggs, beef and poultry all declined.

Overall, wholesale prices had been up by more than 1 percent in both February and March and then 0.7 percent in April and 0.9 percent in May.

Analysts had forecast a small gain of 0.1 percent in June rather than the 0.2 percent decline.

Excluding food and energy, the 0.3 percent rise in core inflation was the biggest increase since February and higher than the 0.2 percent increase in core prices that economists were looking for. However, excluding the jump in new car prices, core prices would have risen by just 0.1 percent.

The price of passenger cars was up 1.4 percent, the biggest gain since last November, while light trucks, the category that includes sport utility vehicles, posted a 1 percent rise.