Stocks rose on Wednesday after the U.S. Federal Reserve said it will keep interest rates near zero and ahead of President Barack Obama's State of the Union address tonight.

But the Nasdaq got a late surge from a gain of almost 1 percent in the shares of Apple Inc after the iPad's debut.

Market analysts said the Fed's decision was not surprising, but the somewhat more optimistic tone of its statement shifted sentiment after a wave of unexpected news from Washington the past two weeks caused the stock market to buckle.

The market rallied because there wasn't anything overtly negative that could be taken from the Fed statement, said Michael James, senior trader at regional investment bank Wedbush Morgan in Los Angeles.

We've been hit by so many negative bits of news (lately), whether from Washington or China, that there was some relief that there wasn't anything overtly negative that could be construed from the Fed statement.

The Dow Jones industrial average <.DJI> gained 41.87 points, or 0.41 percent, to 10,236.16. The Standard & Poor's 500 Index <.SPX> rose 5.33 points, or 0.49 percent, to 1,097.50. The Nasdaq Composite Index <.IXIC> climbed 17.68 points, or 0.80 percent, to 2,221.41.

Apple shares rose 0.9 percent to $207.88, reversing course from a drop of more than 3 percent earlier in the session after the company unveiled its iPad tablet computer.

The Nasdaq also got a boost from Gilead Sciences Inc , which jumped 7.1 percent to $48.04 after the biotech company posted fourth-quarter earnings that topped Wall Street's estimates and forecast a sales increase of about 10 percent for 2010. The NYSE Arca Biotech index <.BTK> gained 1.3 percent.

Boeing was the Dow's top advancer, up 7.3 percent at $61.93 after the world's second-largest aircraft manufacturer reported stronger-than-expected quarterly results and forecast a profitable 2010.

But Dow components Caterpillar and United Technologies Inc slipped after giving cautious forecasts.

Caterpillar shares slid 4.3 percent to $53.44, while United Tech's stock lost 1.3 percent to $67.61.

The U.S. president's first State of the Union address is scheduled to be broadcast live, beginning at 9:00 p.m. tonight.

(Reporting by Chuck Mikolajczak; Additional reporting by Caroline Valetkevitch; Editing by Jan Paschal)