(AP) -- U.S. stocks closed mostly higher Thursday after a late-afternoon wave of selling erased much of a midday rally.
Gains in industrial companies and other sectors outweighed losses in banks and health care stocks. Energy companies also rose after crude oil prices recovered from an early slide.
Bond yields declined after spiking to four-year highs a day earlier amid rekindled fears of higher inflation and interest rates.
"The yields easing back a little bit is probably reassuring people on a very short-term kind of basis," said Erik Wytenus, global investment specialist, J.P. Morgan Private Bank. "That big, nasty intraday reversal yesterday was probably a little bit excessive."
The Standard & Poor's 500 index rose 2.63 points, or 0.1 percent, to 2,703.96. The Dow Jones industrial average gained 164.70 points, or 0.7 percent, to 24,962.48. The 30-company average was up briefly by more than 350 points. The Dow and the S&P 500 snapped a two-day losing streak.
The Nasdaq had been up much of the day, but closed lower. It fell 8.14 points, or 0.1 percent, to 7,210.09. The Russell 2000 index of smaller-company stocks gave up 1.85 points, or 0.1 percent, to 1,529.99.
The stock indexes are on track to close lower for the week.
Bond prices rose. The yield on the 10-year Treasury fell to 2.92 percent from a day earlier, when it climbed to 2.95 percent, the highest level since January 2014. Wednesday's spike in bond yields came after the Federal Reserve's minutes from its January policy meeting showed bullish sentiment among policymakers, confirming their intention to raise interest rates this year.
Higher yields generally hurt stock prices by making bonds more appealing to investors. They also make it more expensive for people and companies to borrow money. Earlier this month, global stock markets, particularly those in the U.S., suffered big losses amid mounting concerns over the pace of inflation and Fed policy tightening.
"Volatility is back, and I actually would argue that it's a healthier state of affairs," Wytenus said. "The constant melt-up that we saw in 2017 is actually quite historically abnormal."
Shares in industrials companies posted solid gains. United Technologies rose after its CEO said management is looking into the possibility of splitting up the industrial conglomerate into three separate businesses. The stock rose $4.32, or 3.3 percent, to $133.58. Caterpillar also notched gains, climbing $3.63, or 2.3 percent, to $158.86.
Investors bid up shares in several companies that reported encouraging quarterly results or outlooks.
Chesapeake Energy was the biggest gainer in the S&P 500, vaulting 57 cents, or 21.7 percent, to $3.20. The company led an energy sector rally.
Avis Budget Group shares also got an earnings boost. The car rental company added $5.24, or 13.4 percent, to $44.20.
Roku slumped 17.7 percent after the video streaming device company's latest guidance disappointed analysts. The stock lost $9.05 to $42.05.
Pandora Media's first-quarter revenue guidance also fell short of Wall Street's forecasts. The music streaming company's shares tumbled 35 cents, or 7.2 percent, to $4.52.
Banks and other financial stocks lagged the most. Brighthouse Financial slid $2.27, or 4 percent, to $55.17.
Benchmark U.S. crude recovered from an early slide, adding $1.09, or 1.8 percent, to settle at $62.77 a barrel in New York. Brent crude, used to price international oils, rose 97 cents, or 1.5 percent, to close at $66.39 per barrel in London.
In other energy futures trading, heating oil gained 2 cents to $1.95 a gallon. Wholesale gasoline added a penny to $1.77 a gallon. Natural gas fell 3 cents to $2.63 per 1,000 cubic feet.
The dollar slid to 106.64 yen from 107.78 yen on Wednesday. The euro strengthened to $1.2329 from $1.2300.
Gold rose $60 cents to $1,332.70 an ounce. Silver dropped 3 cents to $16.59 an ounce. Copper added 3 cents to $3.24 a pound.
Major stock indexes in Europe closed mostly lower. Germany's DAX fell 0.1 percent, while the CAC 40 in France gained 0.1 percent. The FTSE 100 index of leading British shares declined 0.4 percent after figures showed the British economy did not grow as strongly as initially thought during 2017.
In Asia, Japan's benchmark Nikkei 225 index slumped 1.1 percent and South Korea's Kospi shed 0.6 percent. Hong Kong's Hang Seng lost 1.5 percent.