US stocks closed higher Tuesday after Federal Reserve chief Ben Bernanke gave a gloomy assessment of the economy to Congress and said the Fed would act if the situation gets worse. Trade was volatile as investors appeared to shrug off Bernanke\'s downbeat testimony to Senate lawmakers and focus on prospects that the central bank will have to step in with additional economic stimulus. The Dow Jones Industrial Average closed at 12,805.54, gaining 78.33 points (0.62 percent) that more than erased Monday\'s losses. The S&P 500-stock index advanced 10.03 (0.74 percent) to 1,363.67, while the tech-heavy Nasdaq added 13.10 (0.45 percent) at 2,910.04. Stocks reversed earlier losses as investors hoped for more monetary policy easing to boost economic growth. \"Despite no hint of easing, Bernanke did reiterate that the Federal Reserve was prepared to react should the economy deteriorate further,\" said analysts at Wells Fargo Advisors. After the economy grew at a modest rate of roughly two percent in the first quarter of this year, Bernanke said, \"available indicators point to a still-smaller gain in the second quarter.\" June economic data showed little change in economic conditions and were in line with expectations: consumer prices were unchanged from May and industrial production rose 0.4 percent. Better-than-expected quarterly earnings from heavyweights such as Goldman Sachs, Johnson & Johnson and Coca-Cola helped to support sentiment. Dow member Johnson & Johnson rose 0.8 percent after its $1.41 billion earnings reflected more than $2.0 billion in special charges and writeoffs. Fellow Dow component Coca-Cola surged 1.6 percent after reporting stable earnings of $2.79 billion and a 0.3 percent rise in sales. Goldman Sachs edged up 0.3 percent. The Wall Street bank reported $927 million in second-quarter profits, despite global economic turbulence. Yahoo! shed 0.3 percent. The struggling Internet pioneer announced late Monday it had hired key Google executive Marissa Mayer to helm the company, starting Tuesday. Google added 0.3 percent. US stocks scored modest losses Monday after an unexpected fall in retail sales in June for the third straight drop, fueling concerns about consumer spending that drives the economy. Bond prices sank. The 10-year Treasury yield rose to 1.50 percent from 1.46 percent Monday, while the 30-year increased to 2.60 percent from 2.55 percent. Bond prices and yields move in opposite directions.