Updated

NEW YORK (AP) — This time, the stock market had a late-day rally.

Most stocks surged in the final hour of trading Tuesday to give the Dow Jones industrials a gain of 123 points. That ended a two-day slump that sent the Dow down nearly 440 to a seven-month low.

The market's rebound was choppy although Federal Reserve Chairman Ben Bernanke set the tone for the day by saying he didn't expect the economy to go back into recession. The Standard & Poor's 500 index rose, but the Nasdaq composite index slipped as chipmakers fell on downbeat analyst comments.

Like the last two days, most of the action was in the last hour. Tuesday, however, it was buying that accelerated. The Dow was up only about 16 points shortly after 3 p.m., then soared 107 points in the final 43 minutes of trading.

As was also the case Monday, there was no one catalyst for the late move. But the late rally itself drew buyers who had waited to see whether stocks would have another slide before the close. And computer programs also kicked in, with rising stocks triggering more buying — the reverse of the computer selling seen the last two days.

Materials stocks rose after gold extended its gain, briefly touching a record $1,254.50. Chemical maker DuPont climbed 4.1 percent. Meanwhile, oil drilling companies slumped after President Barack Obama blasted the industry in an interview with NBC. Transocean, which owns the oil rig that exploded in the Gulf of Mexico that caused the still-spreading spill, fell 5.8 percent.

Tuesday's rally doesn't signal a change in the market's fragile mood. Uri Landesman, president of Platinum Partners in New York, said traders could go back to selling if more doubts arise about the recovery.

"People's tolerance for bad news is low," he said. "There is a reasonably high chance of bad headlines."

The Dow rose 123.49, or 1.3 percent, to 9,939.98. The Dow had fallen 4.3 percent in the two prior days to its lowest level since Nov. 4.

The S&P 500 index rose 11.53, or 1.1 percent, to 1,062.00. It also fell Monday to its lowest close since November. The S&P's two-day slide of 5.4 percent was its steepest since March 2009.

The Nasdaq fell 3.33, or 0.2 percent, to 2,170.57.

Three stocks rose for every two that fell on the New York Stock Exchange. Consolidated volume came to 6.3 billion shares, compared with 5.6 billion Monday.

Uncertainty about the global economy sent investors looking for safety in gold. There was less demand for the safety of Treasurys, however. The yield on the benchmark 10-year note, which moves opposite its price, rose to 3.19 percent from 3.15 percent late Monday.

Crude oil rose 55 cents to $71.99 per barrel on the New York Mercantile Exchange.

Bernanke said in a speech late Monday that he expects the U.S. recovery to continue, but he acknowledged it is unlikely to be robust.

"It won't feel terrific," Bernanke said.

The Fed releases its Beige Book report Wednesday, which provides a regional snapshot of economic activity.

The chairman's comments reassured traders following Friday's disappointing May jobs report. Bernanke's assessment also eased worries that a slowdown in Europe will spread across the Atlantic.

Traders again tracked movements of the euro. The 16-nation currency has become a measure of confidence in Europe's ability to contain its debt problems and keep its economy growing. The euro rose to $1.1969 a day after hitting a four-year low.

Barbara Marcin, manager at the Gabelli Blue Chip Value Fund in Rye, N.Y., said there have been so many swings in the market because traders are looking six to 12 months ahead to an economy that they believe will be just "mediocre."

She expects questions about the economy to continue to hit stocks for the near future.

"I don't know how you cannot think you're going to have an extremely volatile six months coming up," Marcin said.

Among chip stocks, Intel Corp. fell 13 cents, or 0.6 percent, to $20.18 Marvell Technology Group Ltd. fell 85 cents, or 4.7 percent, to $17.21, while Nvidia Corp. dropped 32 cents, or 2.8 percent, to $11.18.

Materials stocks got a boost from the rise in gold and a rebound in copper. DuPont rose $1.40, or 4.1 percent, to $35.49. Freeport-McMoRan Copper & Gold Inc. rose $2.82, or 4.8 percent, to $61.48.

Oil drilling companies fell after analysts also warned that a ban on deepwater drilling tied to the Gulf oil spill could be extended beyond six months. Obama's comments also brought more bad attention to drillers.

"I don't sit around just talking to experts because this is a college seminar, we talk to these folks because they potentially have the best answers — so I know whose ass to kick," Obama said.

Transocean Corp. fell $2.84, or 5.8 percent, to $46.33. Analysts lowered their ratings on Diamond Offshore Drilling. The stock fell $2.27, or 3.8 percent, to $56.94.

BP PLC, which operated the rig, fell $2.08, or 5.7 percent, to $34.68.

The Russell 2000 index of smaller companies fell 0.80, or 0.1 percent, to 617.69.

Britain's FTSE 100 fell 0.8 percent, Germany's DAX index fell 0.6 percent, and France's CAC-40 dropped 1 percent. Japan's Nikkei stock average rose 0.2 percent.