U.S. stocks closed slightly higher after the Chinese stock market rose. Worries that China's market rout would damage the world's second-biggest economy helped push stocks sharply lower a day earlier.
Investors were also speculating that last-ditch talks between Greece and its creditors would produce a deal to prevent a Greek debt default.
For the day:
The Dow Jones industrial average rose 33.20 points, or 0.2 percent, to 17,548.62.
The Standard & Poor's 500 index gained 4.63 points, or 0.2 percent, to 2,051.31.
The Nasdaq composite climbed 12.64 points, or 0.3 percent, to 4,922.40.
For the week:
The Dow is down 181.49 points, or 1 percent.
The S&P 500 index is down 25.47 points, or 1.2 percent.
The Nasdaq is down 86.82 points, or 1.7 percent.
For the year:
The Dow is down 274.45 points, or 1.5 percent.
The S&P 500 index is down 7.59 points, or 0.4 percent.
The Nasdaq is up 186.34 points, or 3.9 percent.