Investors seized on hope that Washington will reach a deal on the federal budget and drove stocks to their biggest gain in two months. A pair of strong corporate earnings reports also helped.

The Dow Jones industrial average closed up 207 points, or 1.7 percent. Since President Barack Obama and a divided Congress were returned to power Nov. 6, the Dow had fallen six out of eight days and slid a total of 650 points.

Obama and congressional leaders are in talks to avoid going over a “fiscal cliff” on Jan. 1, when tax increases and mandatory government spending cuts are set to take effect.

While Obama and Republicans appear at odds on whether tax rates for the wealthiest Americans should rise, lawmakers suggested over the weekend that progress is possible.

“I can tell you that the fiscal cliff is focusing the mind,” said Illinois Sen. Richard Durbin, a Democrat, said on CNN’s “State of the Union.” He said he had heard from Republicans “the beginning of a negotiation.”

Comments like those comforted investors, who are grasping for signs that the negotiations might go somewhere.

“It is quite clear that both sides want to come to a compromise and that a reasonable compromise is available,” David Kelly, chief global strategist for J.P. Morgan Funds, wrote in a note to clients.

Other financial analysts noted that there have been few substantive developments to drive the market’s swings, and suggested the market’s surge will be short-lived.

“I don’t think anything has changed. It’s just the talk from day to day,” said Stephen Carl, principal and head equity trader at The Williams Capital Group, an investment bank. “We’ll see what happens tomorrow.”

This week’s market will be tougher to decipher, Carl said, because volume is increasingly light leading up to the Thanksgiving holiday. Big price swings are more likely when there are fewer buyers and sellers in the market.

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 (AAPL), 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 recent peak.

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.

Materials stocks, a category that includes foresting companies, metal producers and miners, soared, supported by the latest sign that a recovery in the housing market has stabilized.

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 in each of the past four weeks as traders fretted about the possibility that lawmakers will 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 come slowly, and lawmakers could always reach a deal after Jan. 1.

House Speaker John Boehner and Senate Minority Leader Mitch McConnell said they had offered higher tax revenue as part of a deal. That could include limiting tax deductions for the highest earners.

Monday’s gain for the Dow was its biggest since Sept. 13.

The S&P 500, meanwhile, is trading near a key technical level, said Randy Frederick, managing director of active trading and derivatives at the brokerage Charles Schwab.

For nearly two weeks, the index has closed below its 200-day average, which on Monday stood at 1,382. It surpassed that marker Monday afternoon. Frederick said that might signal more buying.

Technical levels are historic averages and other indicators used by some traders to decide if stocks are a good value.

The market is closed on Thursday for Thanksgiving and will close early Friday.

On Monday, stock indexes in France, Germany and Britain closed up 2.5 percent or more as traders monitored Greece’s quest for its latest round of bailout cash.

Greece needs international lenders and the International Monetary Fund to release the money so that Greece can meet upcoming payments to creditors. Trading in Europe is still volatile. The region has entered recession.

Finance ministers from nations that use the euro will meet Tuesday. Later in the week, leaders will convene to discuss the European Union’s budget for the next few years.

Traders also followed developments in the Middle East as conflict flared between Israel and Hamas. Concerns about instability in the region and hopes for a U.S. fiscal pact pushed benchmark crude up $2.36, or 2.7 percent, to finish at $89.28 per barrel in New York.

Earlier, Asian markets rose more modestly.

The yield on the benchmark 10-year Treasury note rose to 1.61 percent from 1.58 percent late Friday, a sign that traders are selling low-risk investments. A bond’s yield rises as its price falls.

The market’s longer-term direction will likely hinge on U.S. leaders’ ability to attack the fiscal challenge between Thanksgiving and Christmas, Frederick said.

“If they can put some sort of a plan together, or make us believe they have a plan, or at least that there’s some cooperation going on there, that could be a real boost for the market,” he said.

Among big companies making news, Intel (INTC) fell after its CEO of 40 years announced that he will retire in May. The stock rose 6 cents to $20.25.

Diamond Foods hit its lowest price since September 2006 after an analyst cut the snack food company’s rating and price target. Diamond restated two years’ worth of financial results last Wednesday, effectively wiping away $56.5 million in profit from its books. Diamond fell $1.79, or 11.8 percent, to $13.34.

Advanced Micro Devices rose after an analyst said that the stock could see an “early 2013 bounce.” He said investor concerns about the Sunnyvale company’s solvency were overblown and caused traders to oversell. AMD rose 6 cents, or 3.2 percent, to $1.92.