United States stocks staged a forceful rebound Friday, reclaiming much of the ground lost during a turbulent week as crude prices retreated from recent highs. An inflation reading close to economists’ forecasts also eased some of the anxiety gripping Wall Street.

The S&P 500 advanced 0.9 percent, ending a four day losing streak that had become its longest since June. The Dow Jones Industrial Average surged 509 points, or 1 percent, while the Nasdaq composite gained 1 percent.

Oil provided the market with its most immediate source of relief. Brent crude, the international pricing benchmark, dropped 2.8 percent to settle at $104.61 per barrel after approaching $110 overnight amid the continuing war with Iran.

The pullback reduced some of the inflationary pressure created by the recent energy price surge. Expensive crude can quickly filter into gasoline, freight, manufacturing, petrochemicals and consumer goods, raising costs across broad sections of the economy.

Fresh government data showed that United States consumers paid 3.4 percent more for gasoline, food and other living expenses last month than they did a year earlier. The increase remained uncomfortably high, but it was close to economists’ expectations and within the range markets had prepared to absorb.

The report strengthened traders’ conviction that the Federal Reserve will raise its main interest rate at next week’s policy meeting. Higher rates are intended to restrain inflation by increasing borrowing costs, slowing demand and removing momentum from price growth.

Expectations for tighter policy pushed the yield on the two year Treasury to 4.62 percent from 4.56 percent late Thursday. That maturity is particularly sensitive to forecasts for the Federal Reserve’s next moves and often reacts sharply to changes in rate expectations.

Longer maturity yields were comparatively stable, suggesting bond investors may believe additional rate increases could contain inflation over time. The ten year Treasury yield edged up to 4.97 percent from 4.95 percent, while the thirty year yield slipped to 5.36 percent from 5.37 percent.

Economists have argued that raising rates could reinforce the central bank’s inflation fighting credibility. Questions about that commitment intensified earlier in the summer as investors debated whether officials would accept near term economic pain to restore price stability.

Federal Reserve Chairman Kevin Warsh has avoided signaling the direction of policy, although remarks late last month helped settle some investor concerns. President Donald Trump has continued pressing for lower borrowing costs, creating a visible divide between political demands and the inflation challenge confronting policymakers.

"Symbolism can trump substance, even when it comes to monetary policy," according to Brian Jacobsen, chief economic strategist at Annex Wealth Management. His assessment captured the importance investors are placing on the message behind any Federal Reserve action, not merely the size of a potential increase.

Consumer confidence provided a less encouraging signal. A preliminary University of Michigan report found sentiment weakening among both Democrats and Republicans, while expectations for inflation during the coming year climbed to 4.6 percent from 4 percent, the highest reading since June.

Rising inflation expectations are especially troubling because they can influence wage demands, purchasing decisions and corporate pricing. If households and businesses assume costs will continue climbing, their behavior can help create the very inflation they fear.

Among individual stocks, Kroger gained 2.7 percent after reporting quarterly profit above analyst forecasts and maintaining its annual profit outlook. The grocer nevertheless reduced its projection for a closely watched measure of underlying revenue growth.

ACV Auctions soared 44.2 percent after Copart agreed to pay $10.50 in cash for each share of the digital vehicle marketplace. Copart, whose online auctions sold more than 4 million vehicles during the past year, declined 2.6 percent.

Oracle initially jumped 8.5 percent after delivering revenue and profit above expectations, but the advance evaporated and shares closed down 1.7 percent. Artificial intelligence related stocks have grown increasingly unstable as investors question whether enthusiasm for the technology pushed valuations too far.

The S&P 500 finished at 7,656.98 after adding 65.28 points. The Dow closed at 52,573.29, while the Nasdaq composite rose 251.31 points to 26,333.04.

European markets also benefited from easing oil prices, with London’s FTSE 100 gaining 0.4 percent after data showed the United Kingdom economy performed better than expected in July. Asian trading was weaker, as Japan’s Nikkei 225 lost 1.9 percent and South Korea’s Kospi declined 1.8 percent.