A wave of buying in the last hour of trading left stocks mostly higher on Wall Street, enough for the S&P 500 to beat the record high close it set in early September.

The market had spent most of the day wobbling between gains and losses Thursday. Technology companies did well, despite a steep drop in IBM after the company reported disappointing revenue. IBM’s drop left the Dow Jones Industrial Average just barely in the red for the day. The Nasdaq rose.

On Thursday:

The S&P 500 rose 13.59 points, or 0.3%, to 4,549.78.

The Dow Jones Industrial Average fell 6.26 points, or less than 0.1%, to 35,603.08.

The Nasdaq rose 94.02 points, or 0.6%, to 15,215.70.

The Russell 2000 index of smaller companies rose 6.42 points, or 0.3%, to 2,296.18.

For the week:

The S&P 500 is up 78.41 points, or 1.8%.

The Dow is up 308.32 points, or 0.9%.

The Nasdaq is up 318.36 points, or 2.1%.

The Russell 2000 is up 30.53 points, or 1.3%.

For the year:

The S&P 500 is up 793.71 points, or 21.1%.

The Dow is up 4,996.60 points, or 16.3%.

The Nasdaq is up 2,327.42 points, or 18.1%.

The Russell 2000 is up 321.33 points, or 16.3%.