NEW YORK (Reuters) - U.S. stocks rose for a third straight session on Thursday as President Donald Trump said trade talks with China were “moving along nicely,” reviving hopes that the two countries can resolve their trade dispute.

Adding to the upbeat mood, the latest round of results from companies was mostly positive.

After the bell though, shares of Apple Inc AAPL.O fell about 7.0 percent, pushing its market capitalization below $1 trillion, after the company said sales for the crucial holiday quarter could miss Wall Street expectations. The stock ended the regular session up 1.5 percent.

U.S. stock futures fell late Thursday. S&P 500 e-mini futures EScv1 were down 0.4 percent in trading for the overnight session.

During the regular session, the technology index .SPLRCT rose 1.2 percent, continuing to recover from the recent selloff.

Earlier, Trump said he plans to meet with his Chinese counterpart Xi Jinping at the G-20 summit in Argentina at the end of the month.

The trade-sensitive S&P industrial sector .SPLRCI rose 1.7 percent, with Boeing Co BA.N and Caterpillar Inc CAT.N among companies leading the gains.

“Maybe there’s going to be some hope that a trade deal with China will actually come through,” said Robert Pavlik, chief investment strategist and senior portfolio manager at SlateStone Wealth LLC in New York.

Beyond that, investors are feeling a bit more comfortable after gains this week, he said.

Traders work on the floor of the New York Stock Exchange (NYSE) in New York, U.S., October 30, 2018. REUTERS/Brendan McDermid

“Now you get a little bit of fear of missing out, mixing in with, ‘I don’t believe this is actually happening’,” he said. “The fear of missing out seems to be on the winning side.”

Despite ending higher on Wednesday, the S&P 500 closed out its worst month in seven years, following fears of a widening global trade dispute, rising borrowing costs, and that U.S. earnings growth may slow more than forecast in 2019.

The S&P materials index .SPLRCM was up 3.0 percent, with DowDuPont Inc DWDP.N surging 8.1 percent after it reported strong results and plans for a $3 billion share buyback.

The Dow Jones Industrial Average .DJI rose 264.98 points, or 1.06 percent, to 25,380.74, the S&P 500 .SPX gained 28.63 points, or 1.06 percent, to 2,740.37 and the Nasdaq Composite .IXIC added 128.16 points, or 1.75 percent, to 7,434.06.

Also helping were robust earnings reports from three Apple suppliers, NXP Semiconductors NXPI.O, Dialog Semiconductor DLGS.DE and Qorvo Inc QRVO.O.

Technology-related stocks, which have led the stock market’s bull run in recent years, helped lead the selling in October, with the S&P 500 tech index down 8 percent in the month.

The Nasdaq is up 5.4 percent for the last three sessions, its biggest three-day gain since February 2016.

Of the 348 companies in the S&P 500 that have reported results so far, 77 percent have reported earnings above analysts’ expectations, pushing the aggregate third-quarter earnings growth estimate for S&P 500 companies to 26.2 percent, according to IBES data from Refinitiv.

Friday brings the U.S. monthly jobs report for October. Investors will look for further signs of tightening labor market conditions.

Advancing issues outnumbered declining ones on the NYSE by a 3.21-to-1 ratio; on Nasdaq, a 3.46-to-1 ratio favored advancers.

The S&P 500 posted 11 new 52-week highs and three new lows; the Nasdaq Composite recorded 32 new highs and 57 new lows.

About 9.1 billion shares changed hands on U.S. exchanges. That compares with the 8.7 billion daily average for the past 20 trading days.