(AP) -- Solid profits and forecasts from several technology companies helped lift U.S. stocks to modest gains Thursday, nudging the S&P 500 within striking distance of its all-time high.
The benchmark index wavered between small gains and losses through much of the day as investors reviewed another round of third-quarter earnings reports and company outlooks heading into 2020.
Traders have braced for weaker results this earnings season amid concerns about the costly trade war between the U.S. and China, and increased signs of slowing economic growth worldwide.
Earnings reports in the last couple of weeks, representing roughly a third of companies in the S&P 500, have mostly exceeded Wall Street analysts' modest expectations. However, many of those that delivered improved results for the quarter have also issued disappointing profit outlooks. That's led to several days of uneven trading in the markets. On Thursday, decliners outnumbered gainers among stocks in the New York Stock Exchange.
"What we would have needed to see for the market to be really cheering this (earnings) story is if companies were beating and then raising forward expectations," said Rob Haworth, senior investment strategist at U.S. Bank Wealth Management. "But you're not seeing that very consistently."
After moving sideways for much of the day, the S&P 500 added 5.77 points, or 0.2%, to 3,010.29. The index is now within 0.6% of its all-time high set July 26.
The Dow Jones Industrial Average dropped 28.42 points, or 0.1%, to 26,805.53. The Nasdaq, which is heavily weighted with technology stocks, climbed 66 points, or 0.8%, to 8,185.80.
The Russell 2000 index of smaller stocks slipped 2.67 points, or 0.2%, to 1,550.18.
European markets closed broadly higher. Bond prices were little changed. The yield on the 10-year Treasury held at 1.76%.
About one-third of the companies in the S&P 500 have released their results for the July-September quarter. So far, they amount to just over a 1.2% drop in profit overall, according to FactSet. That's much better than initial expectations for a more than 4% contraction in earnings growth for all the companies in the index.
While that's encouraging, investors are also focusing on company outlooks, which have been uneven.
"Financials looked OK, but the tech and industrials have been really mixed," Haworth said. "You had good news from Microsoft, bad news from Texas Instruments, and that's what has everyone stuck."
The tech sector, already the biggest gainer this year, almost singlehandedly accounted for the market's gains Thursday as solid results from Microsoft, PayPal and other technology sector companies offset disappointing quarterly report cards from other companies. Microsoft rose 2%, PayPal climbed 8.6% and Lam Research surged 13.9%.
Traders also cheered encouraging results from several retailers, including O'Reilly Automotive. The auto parts seller jumped 9.2% after it delivered better-than-expected results for the third quarter. It also raised its profit forecast.
Tesla surged 17.7% after the electric car maker surprised Wall Street with a solid profit. Analysts expected the company to report another loss as it struggles to increase sales.
Solid profits helped lift American Airlines 4% and push Southwest Airlines 5.7% higher. American Airlines beat Wall Street profit forecasts thanks in part to lower prices for jet fuel. Southwest overcame the grounding of its Boeing 737 Max jets to beat analysts' profit forecasts.
Other earnings reports and outlooks put investors in a selling mood. Twitter plunged 20.8% on weak financial results, pulling communications services stocks lower.
Shares in several companies also fell after they posted mixed results or weak profit outlooks: Ford slumped 6.6%, 3M lost 4.1%, eBay tumbled 9.1% and Stanley Black & Decker dropped 4.7%.
Benchmark crude oil rose 26 cents to settle at $56.23 a barrel. Brent crude oil, the international standard, gained 50 cents to close at $61.67 a barrel. Wholesale gasoline rose 1 cent to $1.66 per gallon. Heating oil climbed 2 cents to $1.98 per gallon. Natural gas rose 3 cents to $2.32 per 1,000 cubic feet.
Gold rose $9.00 to $1,498.90 per ounce, silver rose 22 cents to $17.74 per ounce and copper was unchanged at $2.66 per pound.
The dollar fell to 108.62 Japanese yen from 108.65 yen on Wednesday. The euro weakened to $1.1108 from $1.1128.