The S&P 500 and Nasdaq rose slightly on Tuesday as news of a major railroad acquisition helped sentiment, but the Dow edged lower on caution before a Federal Reserve statement on interest rates and the economy.

Morgan Stanley's downgrade of semiconductor stocks also limited a broad advance.

The Dow Jones Transportation Average<.DJT> rose 5.3 percent as Warren Buffett's Berkshire Hathaway agreed to buy Burlington Northern Santa Fe Corp in a deal that values the railroad company at $34 billion, Berkshire's biggest deal ever. Burlington shares jumped 27.5 percent to $97.

One of the themes we've been pointing toward is that the next catalyst after earnings is M&A activity, and we've had some big ones, said Tim Smalls, head of U.S. stock trading at brokerage firm Execution LLC in Greenwich, Connecticut. People consider companies to be cheap.

The Federal Open Market Committee began a two-day meeting on Tuesday. While investors expect the Fed to leave rates close to zero, they are nervous to hear what the officials say about the economic outlook.

The Dow Jones industrial average <.DJI> slipped 17.53 points, or 0.18 percent, to end at 9,771.91. But the Standard & Poor's 500 Index <.SPX> added 2.53 points, or 0.24 percent, to finish at 1,045.41. The Nasdaq Composite Index <.IXIC> advanced 8.12 points, or 0.40 percent, to close at 2,057.32.

The S&P is up 55 percent since its early March lows, partly because of stronger-than-expected economic data.

Semiconductors ranked among the major decliners after Morgan Stanley downgraded the sector to cautious from attractive, and cut its view on Dow component Intel Corp , saying inventories were beginning to creep up in the sector.

The PHLX semiconductor index <.SOXX> lost 1.3 percent. [ID:nBNG421836] Shares of Intel slid 2.7 percent to $18.50 on Nasdaq.

Even so, the Nasdaq eked out a gain as investors searched for bargains among tech shares that have suffered losses recently. The Nasdaq has been down five of the past eight sessions.

In other deal news, Black & Decker Corp shares jumped 31 percent to $62, a day after Stanley Works Inc said it struck a deal to buy the company. Stanley shares rose 10.1 percent to $49.69.

Higher oil prices helped lift the S&P 500, with the S&P energy sector index <.GSPE> up 1.1 percent.

U.S. oil futures shot up $1.47, or 1.88 percent, to settle at $79.60 a barrel. ConocoPhillips' stock gained 1.5 percent to $50.75.

Shares of Black & Decker jumped 23.9 percent to $58.66, while shares of Stanley Works were up 4.8 percent at $47.30.

Data showed new orders received by U.S. factories rose more than expected in September but had little impact on the broader market.

Volume was below average on the New York Stock Exchange, with 1.38 billion shares changing hands, below last year's estimated daily average of 1.49 billion, while on the Nasdaq, about 2.18 billion shares traded, below last year's daily average of 2.28 billion.

Advancing stocks outnumbered declining ones on the NYSE by a ratio of 18 to 11, while advancing stocks beat decliners on the Nasdaq, by about 8 to 5.

(Reporting by Caroline Valetkevitch; Editing by Kenneth Barry)