Investors reacted with cautious optimism and Wall Street posted modest gains Tuesday after Federal Reserve Chairman Alan Greenspan (search) told Senate lawmakers he believed the economic recovery was broad-based, but warned about keeping inflation in check.

The Dow Jones industrial average gained 55.01 points, or 0.54 percent, to end higher at 10,149.07. The Nasdaq Composite Index closed higher 33.24 points, or 1.76 percent, to end at 1,917.07, while the Standard and Poor's 500 was up 7.77 points, or 0.71 percent, to end at 1,108.67.

Both indexes racked up their biggest percentage gains in a month and the blue-chip Dow ended higher for the first time in five sessions.

Greenspan's testimony before the Senate Banking Committee (search), in which he praised the economy's overall health, cheered investors somewhat. However, the Fed chairman did warn again that the Fed would keep a close eye on prices and inflation, and would aggressively raise interest rates if need be.

For investors looking for reason to send stocks higher in an otherwise lackluster earnings season, the mixed message did little to provide a direction for the markets. The major indexes failed to break out significantly from the range they had drifted through earlier in the session.

"Unfortunately right now, I think investors need time to get acclimated to the economic environment going forward, rising rates, the earnings growth slowdown, things like that," said Scott Wren, equity strategist for A.G. Edwards & Sons. "I don't think earnings will be the story here unless they really disappoint. It's purely a matter of time for us to break out of this slump."

Also on Tuesday, investors mulled earnings from corporate giants such as Ford Motor Co. (F) and Altria Group Inc. (MO)

Ford fell after it posted second-quarter earnings that more than doubled, but the gains were driven by strength in its finance arm, which could be difficult to maintain as interest rates rise. Its shares ended down 38 cents, or 3 percent, to $14.60.

Dow component Altria, whose products range from Marlboro cigarettes to Kraft macaroni and cheese, said second-quarter profit rose, boosted by the weaker dollar and a lower tax rate. Its shares slipped 5 cents to $48.78.

Corning Inc. (GLW), a maker of fiber-optic cable, reported a profit compared with a year-earlier loss on stronger demand for its liquid crystal display panels. It jumped $1.42, or 13 percent, to $12.69, a day after posting its earnings. It was one of the most actively traded stocks on the NYSE.

Motorola Inc. (MOT) rose 65 cents, or 4 percent, to $16.09 and was the most actively traded stock on the NYSE ahead of its earnings report. After the close, Motorola posted a quarterly net loss due to the spinoff of its chip unit but said it stole share from its rivals in the growing global cell phone market.

Strength in Internet stocks, such as Yahoo Inc. (YHOO) and online marketplace operator eBay Inc. (EBAY) helped boost the technology-packed Nasdaq Composite Index and the broad Standard & Poor's 500 index.

Yahoo rose $1.28, or 5 percent, to $29.39, and eBay, which is due to report earnings after Wednesday's close, rose $1.45, or 2 percent, to $79.95.

In economic news, U.S. home builders fell after a government report showed June housing starts fell to their lowest level in more than a year as rising interest rates slowed the housing market. The Dow Jones Home Construction index dipped 1.9 percent.

KB Home (KBH) fell 83 cents to $65.50, and Pulte Homes Inc. (PHM) dropped 65 cents to $51.40.

Advancing issues outnumbered decliners by about 3 to 2 on the New York Stock Exchange, where volume came to 1.44 billion shares compared with 1.31 billion on Monday.

The Russell 2000 index of smaller companies was up 9.46, or 1.7 percent, at 564.19.

Overseas, Japan's Nikkei stock average closed down 1.55 percent. In Europe, Britain's FTSE 100 closed up 0.4 percent, France's CAC-40 gained 0.4 percent for the session and Germany's DAX index climbed 0.7.

Reuters and The Associated Press contributed to this report.