A spurt in oil prices on Monday revived energy stocks, which have been among the year's worst performers, and helped push the broader market back to record highs.
The Standard & Poor's 500 index climbed 11.42 points, or 0.5 percent, to 2,402.32.
The Dow Jones industrial average gained 85.33 points, or 0.4 percent, to 20,981.94.
The Nasdaq composite gained 28.44, or 0.5 percent, to 6,149.67.
The Russell 2000 index of small-company stocks rose 11.15 points, or 0.8 percent, to 1,393.92.
For the year:
The S&P 500 is up 163.49 points, or 7.3 percent.
The Dow is up 1,219.34 points, or 6.2 percent.
The Nasdaq is up 766.56 points, or 14.2 percent.
The Russell 2000 is up 36.79 points, or 2.7 percent.