Stocks struggled to a mixed finish on Wall Street, trimming the weekly gain for the S&P 500 even as the Nasdaq eked out another record high.

Technology, financial and other stocks declined, outweighing gains in communication services, real estate and utilities companies. Small-company stocks held up better than the broader market, nudging the Russell 2000 index to an all-time high.

Treasury yields edged lower and crude oil prices fell.

On Friday:

The S&P 500 slipped 11.60 points, or 0.3%, to 3,841.47.

The Dow Jones Industrial Average dropped 179.03 points, or 0.6%, to 30,996.98.

The Nasdaq inched up 12.15 points, or 0.1%, to 13,543.06.

The Russell 2000 index of smaller companies added 27.34 points, or 1.3%, to 2,168.76.

For the week:

The S&P 500 rose 73.22 points, or 1.9%.

The Dow added 182.72 points, or 0.6%.

The Nasdaq gained 544.56 points, or 4.2%.

The Russell 2000 picked up 45.56 points, or 2.1%.

For the year:

The S&P 500 is up 85.40 points, or 2.3%.

The Dow is up 390.50 points, or 1.3%.

The Nasdaq is up 654.78 points, or 5.1%.

The Russell 2000 is up 193.90 points, or 9.8%.