Apple surged to its biggest gain in a year and a half Wednesday and drew closer to $1 trillion in value after it reported stronger iPhone sales and rising prices. But losses for energy and industrial companies left major stock indexes lower.

On Wednesday:

The S&P 500 index slipped 2.93 points, or 0.1 percent, to 2,813.36.

The Dow Jones Industrial Average slumped 81.37 points, or 0.3 percent, to 25,333.82.

The Nasdaq composite gained 35.50 points, or 0.5 percent, to 7,707.29.

The Russell 2000 index of smaller-company stocks fell 1.54 points, or 0.1 percent, to 1,669.26.

For the week:

The S&P 500 is down 5.46 points, or 0.2 percent.

The Dow is down 117.24 points, or 0.5 percent.

The Nasdaq is down 30.13 points, or 0.4 percent.

The Russell 2000 is up 5.92 points, or 0.4 percent.

For the year:

The S&P 500 is up 139.75 points, or 5.2 percent.

The Dow is up 614.60 points, or 2.5 percent.

The Nasdaq is up 803.90 points, or 11.6 percent.

The Russell 2000 is up 133.75 points, or 8.7 percent.