A rebound for Nvidia propped up a weakened Wall Street and kept U.S. stock indexes close to their records.

The S&P 500 rose 0.4% Tuesday and neared its all-time high set a week earlier. The Nasdaq composite leaped 1.3% for its first gain in four days. Such strength came even as the majority of stocks on Wall Street outside artificial-intelligence winners fell. The Dow Jones Industrial Average, which doesn't include Nvidia among its members, was a laggard and slumped 0.8%.

Treasury yields were relatively steady after a report showed consumer confidence is a touch better than expected.

On Tuesday:

The S&P 500 rose 21.43 points, or 0.4%, to 5,469.30.

The Dow Jones Industrial Average fell 299.05 points, or 0.8%, to 39,112.16.

The Nasdaq composite rose 220.84 points, or 1.3%, to 17,717.65.

The Russell 2000 index of smaller companies fell 8.47 points, or 0.4%, to 2,022.35.

For the year:

The S&P 500 is up 4.68 points, or 0.1%.

The Dow is down 38.17 points, or 0.1%.

The Nasdaq is up 28.29 points, or 0.2%.

The Russell 2000 is up 0.31 points, or less than 0.1%.

For the year:

The S&P 500 is up 699.47 points, or 14.7%.

The Dow is up 1,422.62 points, or 3.8%.

The Nasdaq is up 2,706.30 points, or 18%.

The Russell 2000 is down 4.73 points, or 0.2%.