U.S. stocks closed higher Thursday as investors moved money out of AI-related stocks and into health care and consumer stocks, Reuters reported.

The Dow Jones Industrial Average rose 556.21 points, or 1.1%, to 52,177.69, the AP reported. The S&P 500 rose 25.12 points, or 0.3%, to 7,744.06 after erasing an early-morning loss, and it pulled closer to its record high set last week. The Nasdaq composite rose 20.16 points, or 0.1%, to 26,713.03. The Russell 2000 index of smaller companies rose 37.74 points, or 1.4%, to 2,767.27. Reuters reported the same closes for the Dow, the S&P 500 and the Nasdaq.

Eli Lilly gained over 3%, UnitedHealth added 2.8% and Walmart rose 1.4% after rating upgrades by Deutsche Bank, Reuters reported. Those three were heavy contributors to the S&P 500's gain. Eight of the 11 S&P 500 sectors rose, led by health care, up 1.84%, Reuters said.

Tech stocks lagged. Nvidia dipped 1.8%, Dell Technologies dropped 6.9% and Hewlett Packard Enterprise fell 7.1%, Reuters reported. The Philadelphia semiconductor index fell 0.9%, its seventh straight decline. Investors were weighing AI companies whose debt loads leave them exposed to rising interest rates, Reuters said.

"The best performing stocks today are the non-cyclical, defensive businesses," Jed Ellerbroek, a portfolio manager at Argent Capital Management, told Reuters.

The gains came a day after the Nasdaq and S&P 500 had their worst days since July, after a hotter-than-expected September consumer inflation report, Investopedia reported. On Thursday, data showed producer prices rose the most in 4-1/2 years in September, Reuters reported. Retail sales rose 0.8% and weekly jobless claims came in at 199,000, Investopedia reported.

Traders now see a 67% chance the Federal Reserve will raise rates by its December meeting, up from 62% on Wednesday, according to CME's FedWatch tool, Reuters reported at 4:14 p.m. ET. The 10-year Treasury yield retreated but stayed near multiyear highs, Reuters said.

For the week, the S&P 500 is down 0.9%, the AP reported.

What we know: The Dow gained 1.1% as money moved from tech to defensive stocks.
What we don't: Whether the shift out of AI stocks will last, or how the Fed will act.