U.S. consumer prices were flat in July versus June, but fell over the past 12 months by the most since 1950, according to government data that suggested benign inflation pressure even amid signs the recession may be winding down.

The Labor Department said on Friday its Consumer Price Index was unchanged after rising 0.7 percent in June, in line with market forecasts for a flat reading.

Gasoline prices fell 0.8 percent after jumping 17.3 percent the previous month, helping to keep overall prices contained. The food index declined 0.3 percent, the biggest fall since May 2002, after being flat in June, while prices for apparel and new vehicles rose in July.

Compared to the same period last year, consumer prices fell 2.1 percent, the largest decline since January 1950, reflecting the huge drop in oil prices since last year's peak.

U.S. government bond prices extended gains on the data, while the dollar deepened losses against the yen.

It is a sign that inflation is not a threat yet, there's been some talk of inflation down the road. It's something to be optimistic about, said Terry Morris, senior equity manager at National Penn Investors Trust Company in Reading, Pennsylvania.

Even as the worst recession since the Great Depression starts to bottom, inflation pressures will likely remain contained given high unemployment and weak demand, analysts said.

On Wednesday, the Federal Reserve left its key overnight lending rate steady near zero, saying substantial resource slack was likely to dampen price pressure and it expected inflation to remain subdued for some time.

The U.S. central bank said economic activity was leveling out, the clearest sign that it saw the recession ending.

Stripping out volatile energy and food prices, the closely watched core measure of consumer inflation rose 0.1 percent in July after increasing 0.2 percent in June, the Labor Department said. That was also in line with market expectations for a 0.1 percent gain.

Compared to July last year, the core inflation rate rose 1.5 percent, the slowest advance since February 2004, after increasing 1.7 percent in June.

(Reporting by Lucia Mutikani; Additional reporting by Ryan Vlastelica; Editing by Andrea Ricci)