U.S. stocks posted strong gains for a second day on Wednesday as investors jumped back into beaten-down financial shares and backed away from safer assets like gold in volatile trading.

In a stunning development after the closing bell, Silicon Valley legend Steve Jobs resigned as chief executive of Apple Inc -- the technology powerhouse he co-founded in a garage. Jobs, 55, is a pancreatic cancer survivor who has been on medical leave for an undisclosed condition since January 17. He has been elected chairman and Tim Cook has been elected CEO, Apple said.

Trading of Apple's stock was halted after hours. In regular trading, Apple had gained 0.7 percent to close at $376.18.

During the regular session, the stock market swung back and forth as investors anticipated a key speech from Federal Reserve Chairman Ben Bernanke on Friday. There had been hope the Fed chief would hint of stimulus to aid the struggling economy, but a more likely outcome is for gradual measures.

Some investors have been buying because it feels, looks like perhaps we've seen the lows of the correction, said Hugh Johnson, chief investment officer of Hugh Johnson Advisors LLC in Albany, New York.

(But) savvy investors don't expect QE3. They do not expect the Federal Reserve to unveil anything significant.

The Dow Jones industrial average was up 142.51 points, or 1.28 percent, at 11,319.27. The Standard & Poor's 500 Index was up 15.19 points, or 1.31 percent, at 1,177.54. The Nasdaq Composite Index was up 21.63 points, or 0.88 percent, at 2,467.69.

The S&P has risen for three straight sessions.

Bank of America Corp rose 11 percent to $6.99, reversing losses on Tuesday when the Dow component hit a 2-1/2-year low on fears it may have to raise large amounts of capital. BofA shares are still down more than 30 percent so far this month.

The S&P financials index advanced 2.8 percent, with JPMorgan Chase & Co shares up 3 percent at $35.83.

Traditional value stocks such as CVS Caremark and Time Warner were among the day's top gainers. CVS shares rose 3.1 percent to $34.44 and Time Warner gained 3.3 percent to $29.84.

Bernanke is due to address central bankers at an annual symposium in Jackson Hole, Wyoming on Friday. His speech last year laid the groundwork for the Fed's unprecedented $600 billion bond buying program, known as quantitative easing, or QE2, to revive a sputtering U.S. economy.

Exchange-traded funds tracking gold stocks and gold-mining stocks fell after bullion futures dropped more than 5 percent in the metal's worst one-day loss since 2008. The SPDR Gold Trust Index declined 3.3 percent, while the Market Vectors Gold Miners Index fell 2.5 percent.

The CBOE Volatility index VIX, Wall Street's fear gauge, fell but remained at high levels, and investors preferred buying traditional value stocks, suggesting there was caution in the market.

The VIX fell 2.5 percent to 35.36 in late session. The gauge generally moves inversely to the stock market as it tracks the price investors pay for protective options on the S&P 500 index.

Barrick Gold shares dropped 3.4 percent to $48.99 and Goldcorp Inc shares fell 3.5 percent to $49.44.

Sectors that led Tuesday's rally, such as energy and technology, shed gains. Growth stocks such as Nvidia fell 1.4 percent to $13.04 and Netflix dropped 1.6 percent to $216.03.

Earlier, the government reported that orders for long-lasting U.S. manufactured goods surged in July, rising twice as much as economists had forecast.

About 8.21 billion shares traded on the New York Stock Exchange, the American Stock Exchange and Nasdaq, slightly lower than last year's daily average of about 8.47 billion.

On the NYSE, advancers beat decliners by a ratio of 2,086 to 923. On the Nasdaq, advancers also beat decliners by 1,689 to 853.

(Reporting by Angela Moon, Editing by Kenneth Barry)