The Dow gained 116 points to 13900. The S&P 500 was up 9 points to 1496. The NASDAQ gained 13 points to 3129.

The major averages recovered from Monday’s decline amid encouraging economic data. Stocks rose after a report showed new home sales unexpectedly increased 15.6% in January to the highest level in more than four years. A separate report revealed consumer confidence rose more-than-expected in February.

The market pared gains briefly during Fed Chairman Bernanke’s testimony to Congress. In his speech, Bernanke defended the central bank’s stimulus measures, but warned that the automatic spending cuts (sequester) that go into effect on March 1 could present a headwind to the economy.

All 10 S&P 500 sectors advanced led by materials and energy. Freeport McMoran gained 1.3% to $31.93 as metal prices rose. Halliburton added 1.6% to close at $40.49. Retailers were higher with Home Depot up 5.7% to $67.56 and Macy’s climbing 2.8% to $39.59 after both reported better-than-expected quarterly results. Homebuilders rallied with Pulte Group advancing 5.7% to $19.05 following the upbeat housing data. Tyson Foods fell 3.7% to $22.40 after the company said margins declined in its beef and pork units.

Breadth was positive on issues by a 2-1 margin on the NYSE and 3-2 on the NASDAQ. Composite volume on the NYSE totaled more than 3.8 billion shares. Treasuries were mostly lower with the 10-year note down 3/16 of a point to yield 1.88%.