U.S. producer prices fell by a larger-than expected amount in July and notched a record decline compared with a year earlier as gasoline prices plummeted, government data on Tuesday showed.

The Labor Department said the seasonally adjusted index for prices paid at the farm and factory gate dropped by 0.9 percent versus a 1.8 percent gain in June.

Analysts polled by Reuters had expected producer prices to decline by 0.3 percent last month.

Compared with the same period last year, producer prices were a record 6.8 percent lower in July. They had been forecast to decline by 5.9 percent.

The longest U.S. recession since the Great Depression of the 1930s has crushed demand and pummeled prices throughout the economy, keeping inflation pressures firmly at bay despite massive official efforts to stimulate growth.

Core producer prices, which exclude food and energy costs, edged 0.1 percent lower in July compared with a forecast for a 0.1 percent rise, and after a 0.5 percent increase in June.

The core producer price index stood 2.6 percent higher measured on a year-on-year basis, versus a forecast for a 2.8 percent advance.

The Labor Department said that gasoline prices fell 10.2 percent in July and were down 45.2 percent versus a year ago, while finished energy goods overall fell by 2.4 percent on the month and 29.7 percent over the past year.

Capital equipment prices edged down 0.2 percent in July but were up 1.8 percent over the year.

Earlier in the production process, prices received by manufacturers of intermediate goods fell by 0.2 percent in July after rising 1.9 percent the month before. The crude goods index was down 4.5 percent after a 4.6 percent rise in June.

(Reporting by Alister Bull; Editing by James Dalgleish)