(AP) -- Stocks on Wall Street closed with modest gains Tuesday after an early rally lost momentum toward the end of the day.
The Nasdaq composite still finished with its second record high in three days, while the Dow Jones Industrial Average ended unchanged from the all-time high it set a day earlier.
The S&P 500 crossed above the 3,100 level for the first time, placing the index on track for its own milestone finish, but the gains didn't hold. Still, the benchmark index rebounded nearly all the way back from a loss Monday that ended a three-day winning streak.
"There was some excitement on breaking 3,100, that perhaps we could continue higher on the S&P," said JJ Kinahan, chief market strategist at TD Ameritrade. "But we've had such an amazing two weeks that without any blockbuster news it was going to be difficult for us to continue higher."
President Donald Trump gave an update Tuesday afternoon on trade negotiations with China, saying both sides are close to a "phase-one" deal. The markets didn't have much of a reaction to the remarks, however.
The S&P 500 rose 4.83 points, or 0.2%, to 3,091.84. The index, which set a record high on Friday, has notched gains the past five weeks in a row.
The Dow Jones Industrial Average closed unchanged at 27,691.49. The Nasdaq gained 21.81, or 0.3%, to 8,486.09, a record.
The Russell 2000 index of smaller companies added 0.35 points, or less than 0.1%, to 1,595.12.
Stock indexes in Europe finished broadly higher.
Momentum for the market has been mostly upward for more than five weeks as worries about the U.S.-China trade war have eased, among other factors.
On Tuesday, President Trump gave markets more reason for optimism on trade during a midday speech at the Economic Club of New York. Trump said the two sides are "close," and that a "phase-one" deal on trade "could happen soon."
Trump's latest update on trade followed conflicting signals from U.S. and Chinese officials last week on whether the two sides have agreed to any tariff rollbacks as part of the tentative trade agreement they're negotiating.
Besides expectations for a stopgap deal on the trade war, stocks have jumped recently due to interest-rate cuts by the Federal Reserve, data showing the economy is still growingly solidly and corporate earnings reports for the summer that weren't as weak as expected.
The rising confidence in markets has meant fewer buyers piling into the safety of gold, which dropped Tuesday to its lowest price in more than three months.
Treasury yields fell slightly after trading resumed following Monday's holiday in observance of Veterans Day. The yield on the 10-year Treasury note slipped to 1.92% from 1.93% late Friday. It was below 1.50% in early September and has been rallying with confidence in the economy's strength.
Reports have shown that the job market is still growing, which should help households keep spending at a strong clip. Such spending makes up the bulk of the economy, and the expectation is that it can more than make up for the weakness in manufacturing that the trade war is causing.
"That's the next thing we look for," Kinahan said, noting that Black Friday, traditionally one of the busiest shopping days of the year, is only a couple weeks away. "Expectations are really high for spending. So, does the consumer live up to it?"
Health care, technology and communication services stocks led the gainers Tuesday, outweighing losses in energy companies and elsewhere.
Disney rose 1.3% on the day that its highly anticipated streaming video service, Disney Plus, launched. The service had some technical difficulties early in the morning, an indication that demand may have been higher than expected.
Rockwell Automation jumped 10.5% for one of the biggest gains in the S&P 500 after reporting earnings that were better than analysts were expecting.
Across the S&P 500, companies are on track to report a drop of 2.4% in third-quarter earnings per share from a year before. That's not as bad as the 4% decline analysts initially expected, according to FactSet. Just over 90% of the companies in the S&P 500 have reported their results for the summer.
Not all companies are delivering solid quarterly results. Advance Auto Parts skidded 7.5% Tuesday after the auto parts retailer cut its full-year estimates for sales and income.
It's a busy week for economic data. The U.S. Labor Department will give updates on consumer and wholesale inflation. Economists expect a government report to show that retail sales returned to growth in October.
And Federal Reserve Chairman Jerome Powell is due to give testimony to Congress on Wednesday about the U.S. economy. Most investors expect the Fed to keep interest rates on hold for now after cutting them three times since the summer.
Benchmark crude oil fell 6 cents to settle at $56.80 a barrel. Brent crude oil, the international standard, fell 12 cents to $62.06 a barrel. Wholesale gasoline was little changed at $1.61 a gallon. Heating oil fell 1 cent to $1.90 per gallon. Natural gas fell 2 cents to $2.62 per 1,000 cubic feet.
Gold fell $3.40 to $1,451.10 per ounce, silver fell 9 cents to $16.68 per ounce and copper fell 2 cents to $2.64 per pound.
The dollar fell to 108.94 Japanese yen from 109.04 yen on Monday. The euro strengthened to $1.1011 from $1.1034.