Stocks closed higher Wednesday, as more gains for big tech companies helped make up for weakness elsewhere across Wall Street.

The S&P 500 had its sixth gain in seven days. While the technology sector led the way higher, companies that rely on consumer spending, banks and communication stocks also helped lift the market.

Bond yields rose broadly. Still, signs of caution in the market remained as gold nudged toward its highest price since 2011.

On Wednesday:

The S&P 500 rose 24.62 points, or 0.8%, to 3,169.94.

The Dow Jones Industrial Average gained 177.10 points, or 0.7%, to 26,067.28.

The Nasdaq composite climbed 148.61 points, or 1.4%, to 10,492.50, a record high.

The Russell 2000 index of small company stocks picked up 11.41 points, or 0.8%, to 1,427.40.

For the week:

The S&P 500 is up 39.93 points, or 1.3%.

The Dow is up 239.92 points, or 0.9%.

The Nasdaq is up 284.87 points, or 2.8%

The Russell 2000 is down 4.46 points, or 0.3%.

For the year:

The S&P 500 is down 60.84 points, 1.9%.

The Dow is down 2,471.16 points, or 8.7%.

The Nasdaq is up 1,519.89 points, or 16.9%.

The Russell 2000 is down 241.07 points, or 14.5%.