Stocks closed higher on Wall Street Tuesday, a day after wrapping up their fifth monthly gain in a row.

The latest gains added to a string of milestones for the S&P 500 and Nasdaq composite, nudging both indexes to all-time highs.

Technology companies were once again a standout, outweighing losses in health care and elsewhere in the market.

On Tuesday:

The S&P 500 gained 26.34 points, or 0.8%, to 3,526.65.

The Dow Jones Industrial Average rose 215.61 points, or 0.8%, to 28,645.66.

The Nasdaq composite added 164.21 points, or 1.4%, to 11,939.67.

The Russell 2000 index of smaller company stocks picked up 16.71 points, or 1.1%, to 1,578.58.

For the week:

The S&P 500 is up 18.64 points, or 0.5%.

The Dow is down 8.21 points, or less than 0.1%.

The Nasdaq is up 244.03 points, or 2.1%.

The Russell 2000 is up 0.24 points, or less than 0.1%.

For the year:

The S&P 500 is up 295.87 points, or 9.2%.

The Dow is up 107.22 points, or 0.4%.

The Nasdaq is up 2,967.06 points, or 33.1%.

The Russell 2000 is down 89.89 points, or 5.4%.