U.S. consumer prices rose slightly in July, but a solid increase in the cost of shelter suggested inflation was probably stabilizing enough to support expectations the Federal Reserve will raise interest rates this year.

The Labor Department said on Wednesday its Consumer Price Index edged up 0.1 percent last month as gasoline and food prices increased marginally. July's increase in the CPI was a slowdown from the 0.3 percent gain in June. It was the sixth straight month of increase in the CPI.

"Modest inflation shouldn’t hold the Fed back from raising rates this year. Prices are bottoming," said Jennifer Lee, a senior economist at BMO Capital Markets in Toronto.

Shelter, which accounts for a third of the CPI, shot up 0.4 percent, the largest increase since February 2007. That was on top of a 0.3 percent again in June.

In the 12 months through July, the CPI climbed 0.2 percent.

It was the second month the annual CPI increased after plunging crude oil prices pushed it into negative terrain in January.

Signs of an ebb in the disinflationary trend, combined with a tightening labor market and strengthening housing sector could give the Fed confidence that inflation will eventually rise toward its 2 percent target.

"Fed officials made clear that they do not need to see higher inflation before hiking. They just need to have reasonable confidence it will return to mandate," said Michelle Girard, chief economist at RBS in Stamford, Connecticut.

Most economists expect the U.S. central to raise its short-term interest rate next month for the first time in almost a decade.

But the pace of monetary tightening is likely to be gradual given the dampening effect on inflation of a strong dollar, renewed weakness in oil and other commodity prices, and China's devaluation of the yuan, which should push down import prices.

Economists polled by Reuters had forecast the CPI rising 0.2 percent from June and gaining 0.2 percent from a year ago.

U.S. Treasury debt prices briefly rose after the data before slipping. The dollar was trading slightly higher against a basket of currencies.

The so-called core CPI, which strips out food and energy

costs, ticked up 0.1 percent last month after rising 0.2 percent

in June. Shelter was the main contributor to last month's rise in the core CPI.

In the 12 months through July, the core CPI increased 1.8 percent. It was the fourth time in five months that the 12-month change was 1.8 percent.

Last month, gasoline prices rose 0.9 percent after rising 3.4 percent in June. Food prices gained 0.2 percent, slowing from a 0.3 percent increase in June as the impact of the bird flu on egg prices eases.

Egg prices rose only 3.3 percent after a June's 18.3 percent surge, which had been the biggest gain since August 1973.

Declining homeownership and a rental vacancy rate near a 22-year low is driving rents higher. Rents increased 0.3 percent in July. There were also increases in the cost of medical care. Apparel prices increased after declining for three straight months.

However, airline fares dropped 5.6 percent, the largest decline since December 1995. Prices for used cars and trucks and household furnishings and new motor vehicles also fell last month.

By Lucia Mutikani - Reuters (Editing by Andrea Ricci)