NEW YORK: U.S. stocks closed with slight gains on Tuesday, sending the S&P 500 and Nasdaq to record levels, as investors assessed the latest comments from Federal Reserve officials for clues on the timing of a rate cut while quarterly earnings from Nvidia drew closer.

Nvidia, Wall Street's third-largest firm by market capitalization, will report results after the closing bell on Wednesday in what is likely to be a significant market catalyst and will test whether the outsized rally in AI-related stocks can be sustained.

Nvidia's options are primed for an 8.7% swing, or $200 billion in market cap, in either direction by Friday, according to data from options analytics firm Trade Alert. The chipmaker's shares were up 0.64% on Tuesday and are up about 93% on the year, after surging nearly 240% in 2023.

Investors also looked toward minutes from the Fed's most recent policy meeting, due on Wednesday, after multiple Fed officials on Tuesday reinforced the stance that it would be best for the central bank to exercise patience before starting to cut interest rates.

"Investors are sort of just sitting on their hands for today because there are two important things that will be coming out tomorrow, Fed minutes combined with Nvidia earnings, so I don't think people want to make any big bets ahead of that," said Sam Stovall, chief investment strategist of CFRA Research in New York.

He said the Fed was "still very much data-dependent and as a result, they're going to do what the data tells them to do and that's pretty much it, but Wall Street is going to continue to forecast, ourselves included, that the Fed will start to cut rates in September."

Markets are currently pricing in a 64.8% chance for a cut of at least 25 basis points at the central bank's September meeting, according to CME's FedWatch Tool.

The Dow Jones Industrial Average rose 66.22 points, or 0.17%, to 39,872.99, the S&P 500 gained 13.28 points, or 0.25%, to 5,321.41 and the Nasdaq Composite gained 37.75 points, or 0.22%, to 16,832.62.

The Nasdaq notched its fourth record close in the past six sessions while the S&P closed at a record for the first time since May 15.

The S&P 500 traded in a range of about 27 points on the session.

Retailers were 0.36% lower as a flurry of quarterly reports from the group signals the winding down of earnings season, with Lowe's shares ending lower after the home improvement company warned of operating-margin pressure in the current quarter.

Automotive parts retailer AutoZone declined 3.53% after a third-quarter sales miss.

Macy's jumped 5.13% after the department store operator raised its annual profit forecast, despite posting a bigger-than-expected drop in sales for the first quarter.

JPMorgan Chase rose 2.01%, recovering some of Monday's 4.5% drop, helping fuel a climb in the S&P 500 banks index.

International Business Machines advanced 2.09% on plans to release a family of artificial-intelligence models as open-source software and help Saudi Arabia train an AI system in Arabic.

Declining issues outnumbered advancers by a 1.07-to-1 ratio on the NYSE and by a 1.35-to-1 ratio on the Nasdaq.

The S&P 500 posted 54 new 52-week highs and six new lows while the Nasdaq recorded 133 new highs and 111 new lows.

Volume on U.S. exchanges was 11.39 billion shares, compared with the 11.87 billion average for the full session over the last 20 trading days.

(Reporting by Chuck Mikolajczak in New York Editing by Matthew Lewis)