The Nasdaq composite index rose 128.93, or 3 percent, to 4,184.56. The Standard & Poor's 500 index rose 13.51 to 1,495.47.
The Dow Jones industrial average rose 147.79 to close at 10,843.87.
IBM led the Dow higher, rising $8.31 to $117.06 at the close of regular trading. Yesterday, the company reported quarterly earnings per share of $1.06, compared with the $1 projected by analysts surveyed by First Call/Thomson Financial. Revenue declined 1 percent to $21.7 billion.
Before today's market rebound, mixed earnings news over the past week had restrained sentiment and given investors few reasons to buy stocks.
"Companies that improved in earnings saw some profit-taking over the prior two days, and companies that missed were taken out and shot immediately," said Bill Meehan, chief market analyst at Cantor Fitzgerald.
But Meehan said today's optimism isn't irrational.
"Traders are still cautious," he said. "They are willing to trade around rather than stand still" on their market positions.
Greenspan gave a positive outlook on the state of the economy this morning in a speech before Congress. He said consumer spending appears to be slowing.
The slowdown, if it continues, will lead to a decrease in demand levels, which in turn takes pressure off inflation. And that means another interest rate hike to control inflation is less likely.
Investors "were afraid that Greenspan was going to be much more hawkish, and there was a relief rally" when he was more upbeat than expected, said Joseph Abate, an economist at Lehman Brothers.
But the speech was not entirely rosy. Greenspan cautioned investors that the Fed could continue to increase interest rates if economic conditions deteriorate.
For example, if wages rise without a concurrent increase in productivity, "then the cost of producing products accelerates, leading to inflation," said Peter Kretzmer, an economist at Banc of America Securities.
At the end of regular trading, Intel closed up $4.56 at $142.69. Microsoft also rose $1.69 to $74.81.
The CNET tech index climbed 55.30 to 2,985.02. Winners edged out losers, with 58 of the 97 stocks in the index rising, 36 falling and three remaining unchanged.
Of the 18 sectors tracked, computer memory storage and Internet services companies posted the sharpest climbs, rising about 6 percent each. Semiconductor equipment makers were the day's biggest losers, falling 2 percent.
The 5.5 million share initial public offering of Airspan Networks, an Internet company, was the biggest percentage gainer on the Nasdaq. Its shares jumped $16.95, or 113 percent, to $31.95. Volume surpassed 11.5 million shares.
Among members of the CNET tech index, ADC Telecommunications posted strong gains. The communication systems maker rose $6.19, or 16 percent, to $44 on a volume of 20.2 million shares, about five times more than the stock's daily average volume.
Siemens chose the communications systems maker's NewNet CALEAserver platform as the preferred system for use by police to intercept private conversations over wireless systems.
Earnings news pulled down shares of Lucent Technologies, Citrix Systems and Conexant Systems.
Lucent fell $10.25, or nearly 16 percent, to $54.25 after the company reported better-than-expected third-quarter earnings but warned of weaker growth ahead. Volume topped 85 million shares, about seven times more than the stock's average daily volume.
Citrix dropped $3.88, or nearly 17 percent, to $18.25 after the company said second-quarter income fell 46 percent to $15 million.
Conexant shares dropped $9.88, or 20 percent, to $39.06 after the company reported a third-quarter loss and announced it would buy two privately held companies for $285 million. Conexant's volume of 37.5 million shares exceeded its daily average by nearly six times.
JDS Uniphase rose $21.38, or 20 percent, to $128.13. The company will replace Rite Aid on the S&P 500 on July 26. Volume topped 78 million shares, making JDS the most actively traded stock on the Nasdaq today. Shares of SDL, a company that JDS plans to acquire, also rose $68.44, or 19 percent, to $428.06.
Investors forgave negative earnings news from Extreme Networks. The company reported an 80 percent drop in fourth-quarter income, but also set a 2-for-1 stock split. Shares of the network equipment maker rose $32.25, or about 28 percent, to $148.25.
The Philadelphia semiconductor index fell 14.28 to 1,146.14, led by chipmaker National Semiconductor, which lost $3.88, or 8 percent, to close at $45.13.