The benchmark S&P 500 and the Dow industrials hit record highs on Monday as investors moved into defensive sectors and stocks recovered from losses earlier in the session.
Economically sensitive groups, such as energy, materials and financials, were weaker after China's factory output and retail sales growth slowed and missed expectations in July, as new COVID-19 outbreaks and floods disrupted business operations.
But healthcare gained 1.1 percent, the best-performing S&P 500 sector. Utilities and consumer staples – also generally regarded as defensive sectors – further bolstered market gains.
The S&P 500 and the Dow both posted record high closes for their fifth straight sessions, even after the major indexes were initially well in the red.
"There is just huge amounts of liquidity, massive amounts of cash out there, both on corporate balance sheets and in private investors' pockets, and because of that every tiny dip that there is, people look for bargains and they buy and they keep it buoyant," said Randy Frederick, vice president of trading and derivatives for Charles Schwab in Austin, Texas.
The Dow Jones Industrial Average rose 110.02 points, or 0.31 percent, to 35,625.4, the S&P 500 gained 11.71 points, or 0.26 percent, to 4,479.71 and the Nasdaq Composite dropped 29.14 points, or 0.2 percent, to 14,793.76.
A rebound in the U.S. economy, including a stellar second-quarter corporate earnings season, and accommodative monetary policy have underpinned positive sentiment for equities. The S&P 500 has gained 100 percent since its March 2020 low.
"The overall environment remains supportive of risk assets, so there is a gravitational pull upward for stocks," said Kristina Hooper, chief global market strategist at Invesco.
Investors are looking for signs about when the Federal Reserve will rein in its easy money policies, with minutes from the central bank's latest meeting due on Wednesday. A resurgence in COVID-19 cases and the impact on the economy are keeping markets on edge, with investors watching earnings reports from major retailers due later in the week.
Investors were also digesting news from Afghanistan, where thousands of civilians desperate to flee the country thronged Kabul airport after the Taliban seized the capital.
In company news, Tesla shares fell 4.3 percent after U.S. auto safety regulators said they had opened a formal safety probe into the company's driver assistance system Autopilot after a series of crashes involving emergency vehicles.
Declining issues outnumbered advancing ones on the NYSE by a 1.75-to-1 ratio; on Nasdaq, a 2.22-to-1 ratio favored decliners.
The S&P 500 posted 68 new 52-week highs and one new lows; the Nasdaq Composite recorded 72 new highs and 259 new lows.
About 8.5 billion shares changed hands in U.S. exchanges, below the 9.2 billion daily average over the last 20 sessions.