The Dow finished up 207.65 points at 12,795.96. The Standard & Poor's 500 index rose 27.01 points, or 2 percent, to 1,386.89. The Nasdaq composite average gained 62.94, or 2.2 percent, to 2,916.07.The S&P 500 and Nasdaq were lifted by Apple, which had its biggest one-day gain since April. It rose $38.05, or 7.2 percent, to $565.73. Some analysts cast doubt on a sell-off that had pushed the stock down more than 20 percent from its peak in September of $702.10. Corporate earnings reports also boosted the indexes. Lowe's said its third-quarter profit surged 76 percent. That followed a strong report from Home Depot last week. Lowe's rose $1.98, or 6.2 percent, to $33.96. Tyson Foods, the country's biggest meat company, beat analysts' expectations for its quarterly earnings. Tyson added $1.84, or 10.9 percent, to $18.72. Materials stocks, a category that includes forestry companies, metal producers and miners, soared, supported by the latest sign that a recovery in the housing market is firmly under way. The National Association of Realtors said sales of previously occupied homes in the U.S. rose in October, helped by a stronger job market and record-low mortgage rates. The pace of sales is roughly 11 percent higher than a year ago. Stocks fell each of the past four weeks as traders fretted that lawmakers would fail to prevent the spending cuts and tax increases from taking effect. Economists have warned that the hit to the economy could total $700 billion for 2013 and push the United States back into recession, although the damage from the "cliff" would be spread throughout the year, and lawmakers could always reach a deal after Jan. 1. The indexes turned positive Friday afternoon, breaking a four-day slump, after signs that Obama and Republicans in Congress were prepared to cede long-held bargaining positions.