Renewed concerns about economic growth in Europe and China weighed on markets on Tuesday, causing stocks to erase all of the previous day's gains.
The Dow Jones industrial average rose 140.25 points, or 0.8 percent, to 17,750.91.
The Standard & Poor's 500 index added 18.06 points, or 0.9 percent, to 2,063.37.
The Nasdaq composite index rose 54.37 points, or 1.1 percent, to 4,763.22.
For the week:
The Dow is down 22.73 points, or 0.1 percent.
The S&P 500 index is down 1.93 points, or 0.1 percent.
The Nasdaq composite is down 12.14 points, or 0.3 percent.
For the year:
The Dow is up 325.88 points, or 1.9 percent.
The S&P 500 is up 19.43 points, or 1 percent.
The Nasdaq is down 244.19 points, or 4.9 percent.