It measures the daily stock price movements of 30 large, publicly-owned US companies.
Technology companies, which suffered the brunt of the selling a day earlier, led the gainers.
Investors welcomed new data showing inflation at the consumer level inched higher in July, suggesting the Federal Reserve may be less likely to raise interest rates next month.
The Dow Jones industrial average closed 14.31 points higher at 21,858.32 after briefly dipping into the negative territory.
S&P 500 measures the performance of 500 widely held common stocks of large-cap USA companies.
In corporate news, USA social media company Snap posted a larger-than-expected loss and smaller-than-expected revenue, sending the stock down more than 10 percent.
J.C. Penney Co. Inc. reported quarterly losses that were lower than investors’ expectations, causing the stock to crater 16.56 percent.
The Russell 2000 is up 17.10 points, or 1.3 percent.