NEW YORK — U.S. stocks ticked higher in a quiet Wednesday after the latest update on inflation came in almost exactly as economists expected.

The S&P 500 rose 0.4% to follow up on one of its best days of the year and climb within 3.7% of its all-time high set last month.

The Dow Jones Industrial Average gained 242 points, or 0.6%, to finish a day above the 40,000 level for the first time in nearly two weeks. The Nasdaq composite edged up less than 0.

1%. Treasury yields were also relatively steady in the bond market after the U.S.

government said consumers paid prices that were 2.9% higher last month for gasoline, food, shelter and other things than a year earlier. The data should keep the Federal Reserve on track to cut its main interest rate at its next meeting in September, a move that Wall Street has long been looking forward to.

The Fed has been keeping rates at an economy-crunching level in hopes of stifling inflation that topped 9% two years ago, and lower interest rates would ease the pressure on both the economy and on prices for investments. The only question is how big the first cut to rates since the 2020 COVID crash will be: the traditional quarter of a percentage point or a more dramatic half point? Wednesday’s reading on inflation at the consumer level wasn’t as cool as the prior day’s update on inflation at the wholesale level, but it likely doesn’t change much, according to Chris Larkin, managing director, trading and investing, at E-Trade from Morga.