Stocks gained ground steadily and closed broadly higher on Wall Street as investors rewarded solid earnings results from several large companies.

The S&P 500 got off to a weak start Wednesday but gained steam throughout the afternoon. The Dow Jones Industrial Average fell, dragged down by big drops in Boeing and Caterpillar.

On Wednesday:

The S&P 500 rose 14.09 points, or 0.5%, to 3,019.56.

The Dow Jones Industrial Average fell 79.22 points, or 0.3%, to 27,269.97.

The Nasdaq composite rose 70.10 points, or 0.8%, to 8,321.50.

The Russell 2000 index of smaller company stocks rose 25.46 points, or 1.6%, to 1,580.42.

For the week:

The S&P 500 rose 42.95 points, or 1.4%.

The Dow rose 115.77 points, or 0.4%.

The Nasdaq rose 175.01 points, or 2.1%.

The Russell 2000 rose 32.52 points, or 2.1%.

For the year:

The S&P 500 is up 512.71 points, or 20.5%.

The Dow is up 3,942.51 points, or 16.9%.

The Nasdaq is up 1,686.22 points, or 25.4%.

The Russell 2000 is up 231.86 points, or 17.2%.