(Reuters) -- Stocks rose on Wednesday after the Federal Reserve said it would keep interest rates near zero through at least 2014 and Apple's spectacular results boosted investor sentiment.

The Fed's low-rate timeframe was even longer than many investors expected, a sign of its commitment to support a sluggish economic recovery.

The Fed also took an historic step of setting an inflation target of 2 percent, a victory for Chairman Ben Bernanke that brings the U.S. central bank in line with many of the world's other central banks.

What caught the market off guard was obviously the fact they are going to keep rates lower for longer, said John Canally, investment strategist at LPL Financial in Boston.

This statement (on an inflation target) moves the ball slightly down the field for possible additional quantitative easing later, Canally said, referring to a type of monetary stimulus.

Apple Inc was a standout in what has otherwise been a fairly lackluster earnings season. So far, 58 percent of companies reporting have beaten forecasts, while at this stage in past earnings seasons, the beat rate averaged 70 percent.

The Dow Jones industrial average <.DJI> was up 47.00 points, or 0.37 percent, at 12,722.75. The Standard & Poor's 500 Index <.SPX> was up 6.54 points, or 0.50 percent, at 1,321.19. The Nasdaq Composite Index <.IXIC> was up 25.81 points, or 0.93 percent, at 2,812.45.

Apple shares were up 6.5 percent to $447.52 after hitting an all-time high of $454.45 on results that sailed past expectations. The move higher pushed Apple's market capitalization above that of Exxon Mobil , making it the largest publicly held U.S. company.

It's a great company; they are executing. To be that big and continue to grow that much is just an amazing, amazing thing and they don't seem to be slowing down, said Joe Saluzzi, co-manager of trading at Themis Trading in Chatham, New Jersey.

Greece was hoping to reach a deal with its bondholders as talks were set to resume this week to avoid a messy default. Such an outcome could threaten the stability of other debt-laden members of the euro zone as well as the global economy.

In other earnings news, both United Technologies Corp and Rockwell Automation Inc slightly missed revenue forecasts, with earnings growth reflecting a focus on cost controls. United Tech shares were flat at $77.75 and Rockwell dropped 2.8 percent to $79.46.

Another diversified manufacturer, Textron Inc , surged 15 percent to $24.85 after it raised its 2012 profit forecast. The S&P industrials index <.GSPI> gained 0.3 percent.

Corning Inc tumbled 10.3 percent to $13.12 as manufacturers cut back on the production of big-screen televisions that use the company's specialty glass.

(Reporting By Angela Moon; additional reporting by Rodrigo Campos; Editing by Kenneth Barry)