(AP) -- Stocks closed broadly higher on Wall Street Thursday as investors welcomed another batch of encouraging quarterly results from big companies.
A breakthrough in negotiations over Britain's exit from the European Union also helped put traders in a buying mood.
The gains erased the market's modest losses from the day before. Despite a choppy week of trading, the benchmark S&P 500 index is on track for its second straight weekly gain.
Health care, communication services and industrial stocks drove much of the market's gains. Technology was the only laggard. Smaller-company stocks outdid the rest of the market.
Investors have shifted their focus this week to the latest round of corporate earnings after weeks of turbulence on Wall Street as the market reacted to developments in the trade war between the U.S. and China.
Several companies have turned in surprisingly good third-quarter results and outlooks. That's helped to ease some investors' concerns over the economy, though red flags remain over the trade war.
"About 76% of those that have reported have beat on earnings," said Adam Taback, deputy chief investment officer at Wells Fargo Private Bank.
The forecasts from companies haven't been as negative as many expected, Taback said, but many have raised concerns about "slowing global growth and risk of trade wars."
The S&P 500 index gained 8.26 points, or 0.3%, to 2,997.95. The index is within 0.1% of its all-time high set in July.
The Dow Jones Industrial Average briefly slipped into the red, but managed to add 23.90 points, or 0.1, to 27,025.88. The Nasdaq rose 32.67 points, or 0.4%, to 8,156.85.
Traders favored smaller-company stocks. The Russell 2000 index climbed 16.79, or 1.1%, to 1,541.84.
Bond prices fell. The yield on the 10-year Treasury note rose to 1.75% from 1.74% late Wednesday.
The market climbed in the early going as investors reviewed the latest batch of corporate earnings reports from several companies, including Netflix, CSX and Morgan Stanley.
Traders bid up shares in Netflix 2.5% a day after the video streaming giant reported earnings that blew past analysts' forecasts. The profit beat came even as revenue and subscriber growth fell short of forecasts, though some investors had been bracing for an even bigger letdown.
Netflix is facing major threats to its video streaming service from Apple and Disney, among others. That, and investors' concerns about subscriber growth, have been weighing on the stock recently, pulling it down 23% from a recent peak in early July.
Honeywell International also served up earnings that topped analysts' forecasts. The stock added 2.4%. Railroad operator CSX also turned in quarterly results that were better than investors were expecting. Its shares finished 1.1% higher.
Morgan Stanley climbed 1.5% after the bank reported solid third-quarter results.
U.S. stocks also got a boost from news that Britain had reached a tentative deal to separate from the European Union. The deal, which faces a potentially tough road to approval in Britain's Parliament, led to a mixed finish for major European stock indexes.
Despite a midmorning wobble, U.S. stocks held on, extending their gains for the week.
Health care stocks continued to notch gains Thursday. October has been good month for the sector. It's up 2.1% for the month so far and 2.4% this week. By comparison, the S&P 500 index is up about 0.9% for the week and 0.7% for the month.
Even with the recent gains, health care stocks are well behind most other sectors, with only a 6.4% gain for the year. Most other sectors are up by double digit percentages.
Benchmark crude oil rose 57 cents to settle at $53.93 a barrel. Brent crude oil, the international standard, rose 49 cents to close at $59.91 a barrel. Wholesale gasoline was unchanged at $1.62 per gallon. Heating oil climbed 1 cent to $1.95 per gallon. Natural gas rose 2 cents to $2.32 per 1,000 cubic feet.
Gold rose $4.30 to $1,492.30 per ounce, silver rose 19 cents to $17.54 per ounce and copper rose 1 cent to $2.59 per pound.
The dollar fell to 108.68 Japanese yen from 108.77 yen on Wednesday. The euro strengthened to $1.1124 from $1.1072.