WASHINGTON - U.S. consumer spending increased in August, but underlying inflation moderated, with the year-on-year rise in prices excluding food and energy slowing to below 4.0%.

Consumer spending, which accounts for more than two-thirds of U.S. economic activity, gained 0.4% last month, the Commerce Department reported on Friday. Data for July was revised higher to show spending increasing 0.9% instead of the previously reported 0.8%. Economists polled by Reuters had forecast spending would gain 0.4%.

Some the rise in spending last month reflected higher prices. Gasoline prices accelerated in August, peaking at $3.984 per gallon in the third week of the month, the highest this year, according to data from the U.S. Energy Information Administration. That compared to $3.676 per gallon during the same period in July.

With gasoline price surging, inflation as measured by the personal consumption expenditures (PCE) price index rose 0.4% in August after climbing 0.2% in July. In the 12 months through August, the PCE price index advanced 3.5% after rising 3.4% in July. The annual PCE inflation is also being lifted by a lower base of comparison last year.

But underlying inflation pressures are subsiding, which will be welcomed by Federal Reserve officials.

Excluding the volatile food and energy components, the PCE price index gained 0.1%, after increasing 0.2% in the prior month. The so-called core PCE price index increased 3.9% on a year-on-year basis in August after rising 4.3% in July.

The U.S. central bank tracks the PCE price indexes for its 2% inflation target. The Fed held interest rates steady last week but stiffened a hawkish monetary policy stance. Since March 2022, the central bank has raised its policy rate by 525 basis points to the current 5.25%-5.50% range.

(Reporting by Lucia Mutikani; Editing by Paul Simao)