WASHINGTON (Reuters) - U.S. consumer prices rose in July and the underlying trend continued to strengthen, pointing to a steady increase in inflation pressures that keeps the Federal Reserve on track to gradually raise interest rates.

FILE PHOTO: A woman shops with her daughter at a Walmart Supercenter in Rogers, Arkansas, U.S., June 6, 2013. REUTERS/Rick Wilking/File Photo

The Labor Department said on Friday its Consumer Price Index advanced 0.2 percent, the bulk of which was due to a rise in the cost of shelter, driven by higher rents. The CPI rose 0.1 percent in June.

In the 12 months through July, the CPI increased 2.9 percent, matching the increase in June.

Excluding the volatile food and energy components, the CPI rose 0.2 percent, the same gain as in May and June. The annual increase in the so-called core CPI was 2.4 percent, the largest rise since September 2008, from 2.3 percent in June.

Economists polled by Reuters had forecast both the CPI and core CPI rising 0.2 percent in July.

U.S. Treasury yields held near three-week lows and U.S. stocks fell on anxiety about Turkey's financial woes and its deepening rift with the United States. The U.S. dollar .DXY was trading higher against a basket of currencies.

“As the July CPI figures make clear, underlying price pressures are still mounting,” said Michael Pearce, senior U.S. economist at Capital Economics in New York.

The Fed more closely tracks a different inflation measure, the personal consumption expenditures (PCE) price index excluding food and energy, which increased 1.9 percent in June.

That gauge hit the U.S. central bank’s 2 percent target in March for the first time in more than six years and Fed policymakers have said they will not be unduly concerned if it overshoots its target in the coming months.

The U.S. central bank has raised rates twice this year, in March and June, and financial markets overwhelmingly expect a hike at the next policy meeting in September.

The Fed currently forecasts a total of four rate rises in 2018, with investors expecting a final nudge upwards of the year in the benchmark overnight lending rate in December.

Inflation pressures are seen continuing to build amid low unemployment and increasing difficulty reported by employers in filling positions. Rising raw material costs are also expected to push up inflation as manufacturers pay more, in part because of tariffs imposed by the Trump administration on lumber, aluminum and steel imports.

Last month, gasoline prices fell 0.6 percent after increasing 0.5 percent in June. Food prices edged up 0.1 percent after rising 0.2 percent in June.

Owners’ equivalent rent of primary residence, which is what a homeowner would pay to rent or receive from renting a home, advanced 0.3 percent last month after increasing by the same margin in June. Overall, the so-called shelter index rose 3.5 percent in the 12 months through July.

Healthcare costs fell 0.2 percent after gaining 0.4 percent in June. Prices for new motor vehicles rose 0.3 percent in July following a 0.4 percent increase in the prior month. Apparel prices were down 0.3 percent after a 0.9 percent drop in June.