U.S. stocks closed higher Tuesday, briefly sending the S&P 500 index to an all-time high. The benchmark index eked out a slight gain, finishing a little below the high mark it set in January. The gain, which carried the Russell 2000 index of small-company stocks to an all-time high, came as the market's bull run was set to become the longest on record on Wednesday.

On Tuesday:

The S&P 500 rose 5.91 points, or 0.2 percent, to 2,862.96.

The Dow Jones Industrial Average gained 63.60 points, or 0.2 percent, to 25,822.29.

The Nasdaq composite index added 38.17 points, or 0.5 percent, to 7,859.17.

The Russell 2000 picked up 19.35 points, or 1.1 percent, to 1,718.05.

For the week:

The S&P 500 is up 12.83 points, or 0.5 percent.

The Dow is up 152.97 points, or 0.6 percent.

The Nasdaq is up 42.84 points, or 0.5 percent.

The Russell 2000 is up 25.10 points, or 1.5 percent.

For the year:

The S&P 500 is up 189.35 points, or 7.1 percent.

The Dow is up 1,103.07 points, or 4.5 percent.

The Nasdaq is up 955.78 points, or 13.8 percent.

The Russell 2000 is up 182.53 points, or 11.9 percent.