U.S. consumer prices rose faster than expected in August from July on a spike in gasoline costs, government data showed on Wednesday, but the underlying trend pointed to muted inflation pressures.

The Labor Department said its Consumer Price Index rose 0.4 percent last month after having been flat in July, a touch above market expectations for a 0.3 percent gain.

Gasoline prices surged 9.1 percent after falling 0.8 percent in July. Compared to the same period last year, consumer prices declined 1.5 percent. Prices have been falling on an annual basis since March this year.

Stripping out volatile energy and food prices, the closely watched core measure of consumer inflation rose 0.1 percent in August after rising 0.1 percent in July.

This was as prices for new vehicles fell 1.3 percent, the largest decline since October 1972, reflecting government-sponsored incentives that gave discounts to consumers to trade in their old gas-guzzling cars for new, fuel-efficient ones. The Labor Department said the program that ended in August could potentially impact CPI into September.

Markets had expected core CPI to rise 0.1 percent last month. Compared to August last year, the core inflation rate rose 1.4 percent, the smallest rise since February 2004, after increasing 1.5 percent in July.

Analysts are closely watching consumer prices for signs of inflation pressures in the wake of massive efforts by the government and the Federal Reserve to rescue the economy from the worst recession since the Great Depression of the 1930s.

Government data on Tuesday showed a spike in producer prices in August as energy costs soared, but analysts reckon labor market slack and weak domestic consumption will keep price pressures in check for a while.

(Reporting by Lucia Mutikani; Editing by Andrea Ricci)