NEW YORK (Reuters) - The Dow and S&P 500 began the fourth quarter on a positive note on Monday, after a last-minute deal to salvage NAFTA as a trilateral pact helped ease trade worries, although major indexes finished off their session highs.

Canada and Mexico accepted more restrictive commerce in the new United States-Mexico-Canada Agreement (USMCA), which will make it harder for global automakers to build cars cheaply in Mexico and aims to bring more jobs to the United States.

Industrial stocks, and more specifically auto and rail-related shares rose. Ford Motor Co F.N gained 0.8 percent, while General Motors Co GM.N advanced 1.6 percent. Among railroads, Kansas City Southern KSU.N rose 2.9percent.

The industrial sector .SPLRCI, sensitive to trade developments in recent months, was up 0.9 percent, its best day in five weeks.

“It is good news not only for NAFTA and North America in general but a lot of market participants are really viewing this as a positive for future negotiations, especially with China,” said Lindsey Bell, investment strategist at CFRA Research in New York.

“It is short on detail but the market seemingly doesn’t care, I am definitely interested in seeing exactly what the details are.”

The biggest boost to the industrials, however, was General Electric Co GE.N, which rose 7.1 percent and was set for its best day in three-and-a-half years after replacing Chief Executive John Flannery with board member Larry Culp, who, investors hope can transform the company's portfolio more quickly.

FILE PHOTO: Traders work on the floor of the New York Stock Exchange (NYSE) in New York, U.S., September 21, 2018. REUTERS/Brendan McDermid

The Dow Jones Industrial Average .DJI rose 192.9 points, or 0.73 percent, to 26,651.21, the S&P 500 .SPX gained 10.61 points, or 0.36 percent, to 2,924.59 and the Nasdaq Composite .IXIC dropped 9.05 points, or 0.11 percent, to 8,037.30.

October is traditionally one of the tougher months for the S&P, although LPL Financial’s senior market strategist Ryan Detrick points out the S&P 500 has averaged a 3.3 percent return during October in midterm election years.

Aside from industrials, the materials .SPLRCM and energy .SPNY sectors also rose more than 1 percent. Energy stocks got a boost as crude oil prices hit their highest level since 2014 on a combination of the new trade agreement and U.S. sanctions on Iran.

Small-cap stocks were under pressure, with the Russell 2000 .RUT off 1.39 percent. Smaller names had been seen as more immune to trade pressures and the index is now off nearly 4 percent from its Aug. 31 high.

The defensive real estate .SPLRCR and utilities .SPLRCU sectors led the decliners.

Still gains, faded late in the session and the Nasdaq was negative, weighed down by declines in Facebook Inc FB.O off 1.2 percent and Intel Corp INTC.O, down 1.8 percent.

Tesla Inc TSLA.O shares soared 17.3 percent as signs it had met targets for quarterly production numbers added to relief at Chief Executive Elon Musk's settling a lawsuit with regulators that could have forced him out.

Declining issues outnumbered advancing ones on the NYSE by a 1.34-to-1 ratio; on Nasdaq, a 1.88-to-1 ratio favored decliners.

The S&P 500 posted 46 new 52-week highs and 10 new lows; the Nasdaq Composite recorded 99 new highs and 84 new lows.

Volume on U.S. exchanges was 6.86 billion shares, compared with the 6.89 billion average for the full session over the last 20 trading days.