Energy and materials companies helped lift stocks modestly higher Wednesday, nudging the Dow Jones Industrial Average to an all-time high.

Industrial and financial stocks also had a strong showing, outweighing losses in communication services companies and elsewhere.

The gains put the market back on positive footing following a small pullback a day earlier.

On Wednesday:

The S&P 500 index rose 5 points, or 0.1%, to 3,732.04.

The Dow Jones Industrial Average gained 73.89 points, or 0.2%, to 30,409.56.

The Nasdaq composite picked up 19.78 points, or 0.2%, to 12,870.

The Russell 2000 index of smaller companies climbed 20.63 points, or 1.1%, to 1,979.99.

For the week:

The S&P 500 is up 28.98 points, or 0.8%.

The Dow is up 209.69 points, or 0.7%.

The Nasdaq is up 65.27 points, or 0.5%.

The Russell 2000 is down 23.96 points, or 1.2%.

For the year:

The S&P 500 is up 501.26 points, or 15.5%

The Dow is up 1,871.12 points, or 6.6%.

The Nasdaq is up 3,897.40 points, 43.4%.

The Russell 2000 is up 311.52 points, or 18.7%.