NEW YORK ( TheStreet) -- U.S. stocks closed higher Wednesday as Federal Reserve Chairman Ben Bernanke reiterated an accommodative tone on monetary policy, easing concern the central bank is seeking to curb the bond-buying stimulus program that has helped boost equity markets for more than 18 months. The S&P 500 rose 0.3% to 1,680.90, extending the index's 2013 advance to 18%. The Dow Jones Industrial Average gained 0.1% to 15,470.52 while the Nasdaq added 0.3% to 3,610. The Fed chairman in testimony before the House Financial Services Committee said that if economic conditions improve faster than expected and inflation moves much higher, the bank could reduce asset purchases more quickly and tapering could begin later this year. Conversely, if the employment outlook were to become relatively less favorable and inflation doesn't moving towards 2%, the current pace of purchases could be maintained for a longer period of time. "If needed, the Committee would be prepared to employ all of its tools, including an increase in the pace of purchases for a time, to promote a return to maximum employment in a context of price stability,'' Bernanke said. Markets were generally bolstered after Bank of America ( BAC) reported second-quarter profit that beat forecasts. BofA shares jumped 2.8% to $14.31 as the Charlotte-based bank said net profit for the quarter rose 63% to $4 billion from $2.5 billion a year ago as it slashed $1 billion in expenses. Yahoo! ( YHOO) surged 10% to $29.67 as Alibaba Group Holding, the Chinese e-commerce company of which it owns 24%, tripled its fiscal first quarter profit. Bank of New York Mellon ( BK) advanced 1.9% to $30.92 after reporting strong second-quarter results, with record revenue and a very significant increase in fee income. The custody bank reported second-quarter net income applicable to common stockholders of $833 million, or 71 cents a share, compared to a net loss of $266 million, or 23 cents a share, in the first quarter, and earnings of $567 million, or 39 cents a share, during the second quarter of 2012. Mattel ( MAT) experienced the sharpest selloff, losing 6.8% to $43.16 after the toy company posted second quarter earnings that missed Wall Street's expectations and Barbie sales fell a fourth consecutive quarter. Bond yields were collapsing after Bernanke's remarks and amid a spate of downbeat housing market numbers. The benchmark 10-year Treasury was gaining 12/32, diluting the yield to 2.491% back beneath 2.5% where they last traded ahead of Independence Day. Gold for August delivery at the COMEX division of the New York Mercantile Exchange meanwhile posted a choppy session and settled lower by $12.90 at $1,277.50 an ounce. Headline housing numbers took on a downbeat tone Wednesday. Housing starts declined to a less than expected seasonally adjusted annual rate of 836,000 in June from an upwardly-revised 928,000 in May, according to the Census Bureau. Economists, on average, were expecting a print of 959,000, according to a Thomson Reuters poll. Building permits fell to a less than expected annual pace of 911,000 from an upwardly-revised 985,000. Economists were expecting an annual pace of 1 million. The Mortgage Bankers' Association reported before the market open that its seasonally adjusted index of mortgage application activity declined 2.6% in the week ended July 13 as appetite for refinancing loans soured as mortgage interest rates stayed at two-year highs. Follow @atwtse Written by Andrea Tse and Joe Deaux in New York >To contact the writer of this article, click here: Andrea Tse.>.