By Michael Wursthorn and Caitlin Ostroff
The S&P 500 eked out a small gain Thursday to close at a fresh record following a tepid session of trading.
The broad index rose in the final hour of trading as shares of real-estate companies and material firms notched gains along with communication and consumer-discretionary stocks.
That helped overcome a steep decline in shares of Cisco Systems, which weighed on the stock market throughout Thursday's session and kept the Dow Jones Industrial Average and the Nasdaq Composite in the red.
Analysts blamed the tepid trading session on fresh signs of doubt around the U.S.'s ability to clinch the first part of a trade truce with China later this year. The Wall Street Journal reported Wednesday that U.S. and China continue to haggle over agriculture purchases, giving investors little enthusiasm to broadly buy riskier assets.
While stocks were listless throughout most of the session, assets considered to be safe stores of value notched bigger moves. Gold rose 0.6%, while the yield on the yield on the benchmark 10-year U.S. Treasury note fell a third straight day. Prices rise as yields fall.
"Investors need to see something that they're comfortable with on the trade front," said Mike Bailey, director of research at FBB Capital Partners. Until then, "It's a 'hold your breath' type of market," he added.
Investors will continue to monitor the U.S.-China trade situation, analysts said, as well as the latest economic figures due Friday on retail sales and industrial production.
The S&P 500 rose 2.59 points, or less than 0.1%, to 3096.63 Thursday. The Dow industrials, meanwhile, fell 1.63 points, or less than 0.1%, to 27781.96, and the Nasdaq Composite declined 3.08 points, or less than 0.1%, to 8479.02.
All three indexes were hampered by Cisco's $3.55, or 7.3%, pullback to $44.91, its biggest drawdown in roughly three months, after the company said late Wednesday that it expects to book its first quarterly revenue decline in more than two years. The networking giant, considered a proxy for corporate high-tech hardware demand, blamed lighter customer spending for the lackluster outlook.
"We're painfully aware of the situation" with Cisco, Mr. Bailey said. Despite Cisco's bellwether status, the company's problems appear to be restricted to itself, he added.
Technology stocks in the S&P 500 fell 0.1%, as shares of several other communications equipment companies declined along with some semiconductor stocks. Kraft Heinz also slid $1.94, or 5.9%, to $30.96 after Goldman Sachs cut its rating on the food company.
Real estate and material stocks rallied 0.8% and 0.5%, respectively, by the session's end, helping the S&P 500 overcome Cisco's weakness. Shares of communication, consumer discretionary and industrial companies also rose, giving the broad index some support.
Elsewhere, the Stoxx Europe 600 fell 0.4%, led by declines in auto makers.
Asian stocks, meanwhile, were mixed, with the Shanghai Composite up 0.2%, while Hong Kong's Hang Seng waned 0.9% as antigovernment protests snarled the city.
Write to Michael Wursthorn at Michael.Wursthorn@wsj.com and Caitlin Ostroff at firstname.lastname@example.org