Updated from 4:06 p.m. EDT

Investors went on a buying spree Tuesday amid some newfound optimism about the economy and the technology sector.

The Dow Jones Industrial Average ended up almost 180 points, or 2.1%, at 8781, while the S&P 500 climbed 18 points, or almost 2%, to 951. The Nasdaq gained 46 points, or 3.1%, to 1556.

"Housing and consumer confidence data were the catalysts to reverse the market out of its losing streak, indicating we may have hit a bottom," said Charles White, a portfolio manager at Avatar Investors. "But the action today doesn't reek of a stampede. The proof will be if we get a follow-through tomorrow and hold on to those levels."

The Conference Board said consumer confidence rose to 83.8 in May, its highest level in five months, from 81 the previous month. Still, analysts said the consumer gauge remained below the 2002 average, suggesting that consumers remain on edge amid continuing contraction in the labor market.

New-home sales rose unexpectedly in April, hitting their best pace this year amid low mortgage rates. Sales increased 1.7% to a 1.028 million annual rate from a revised 1.011 million rate in March, the Commerce Department said. Economists had expected a decline to 985,000. Existing-home sales also rose more than expected to 5.84 million on an annualized basis, from 5.53 million the prior month.

Some homebuilding shares gained following the housing reports. Pulte Homes ( PHM) rose 79 cents, or 1.2%, to $64.50. But others fell, with KB Home ( KBH) losing 7 cents, or 0.1%, to $57.27.

There also was strength in Internet stocks, with eBay ( EBAY), posting a rise of $3.61 to $103.05, a multiyear high for the stock. Yahoo! ( YHOO) climbed $1.48, or 5.2%, to a 52-week high of $29.97, while Amazon.com ( AMZN) closed at $34.85, up $2.13, or 6.5%.

Biotechnology shares also moved higher, with the Amex Biotech Index up more than 4%, amid gains in Genentech ( DNA), Genzyme ( GENZ) and Gilead ( GILD).

Genentech said last week that its experimental colon cancer drug Avastin extends life longer than was expected for the drug. Hopes that new cancer therapies will improve life expectancy among patients have been pushing the sector's stocks up in the past few weeks. Shares of the company rose $2.92, or 4.8%, to $63.85.

Gilead Sciences, maker of the AIDS drug Viread, said European regulators approved the drug as a first-time treatment for HIV-positive adults. Shares rose $3.64, or 7.6%, to $51.64.

Another biotech player, Cell Therapeutics ( CTIC), jumped $1.09 cents, or 9.1%, to $13.05 after the company reported encouraging response rates for the Triseno cancer drug it markets.

Altria Group ( MO), the parent company of Philip Morris, fell after a federal judge declined a request to dismiss claims of advertising fraud against U.S. cigarette makers. Shares of the company had gained almost 30% last week after a Florida appeals court threw out a $145 billion damages award against the industry. Shares of Altria fell 22 cents, or 0.5%, to $42.09.

Former AOL Time Warner ( AOL) Chairman Steve Case seems to be favoring the reversal of the deal that united the two media companies, The New York Times reported. Shares of the company gained 27 cents, or almost 2%, to $14.98. Tenet Healthcare ( THC), the second-largest operator of hospital chains in the U.S., said Tuesday that Chief Executive Officer Jeffrey Barbakow had resigned amid government scrutiny over the company's billing practices. Shares of the company rose 59 cents, or 3.8%, to $16.14.

Wal-Mart ( WMT) said it expects to meet estimates for May sales. Wal-Mart shares added 50 cents, or 1%, to $52.50.

Morgan Stanley ( MWD) said it is countersuing luxury goods retailer LVMH ( LVMHF) for damages related to a case involving alleged tainted analysis at the investment bank. Shares of Morgan Stanley gained $1.1, or 2.6%, to $44.

ImClone Systems ( IMCLE) received a $6 million payment from Merck KGaA for achieving a milestone that will enable the German company to import the Erbitux cancer drug. Shares of ImClone jumped $4.75, or 23.9%, to $24.60.

On the NYSE, 1.5 billion shares traded hands, with advancers outpacing decliners by a ratio of 23 to 10. Almost 1.9 billion shares traded hands at the Nasdaq, with winners leading losers by 23 to 9.

Treasuries were lower, with the yield on the 10-year note up 5 basis points at 3.38%. Crude oil futures were higher in London at about $26.60.

The euro continued to gain strength against the dollar, rising above $1.19, a new record for the European currency. The dollar was little changed against the yen.

Overseas markets were mostly weaker, with London's FTSE 100 down 0.4% at 3962 and Germany's Xetra DAX up 0.2% at 2833. In Asia, Japan's Nikkei closed 1.3% lower at 8120, while Hong Kong's Hang Seng fell 0.8% to 9420.

On Friday, the Dow added 7 points, or 0.1%, to 8601. The S&P 500 rose 1 point, or 0.1%, to 933, while the Nasdaq gained 2 points, or 0.2%, to 1510.

If you liked this article you might like

Tech Shares Take a Hit

Tech Shares Take a Hit

Review Date Is Big News for CV Therapeutics

Review Date Is Big News for CV Therapeutics

Four Citigroup Brokers Cut Loose in Fund Scandal

Four Citigroup Brokers Cut Loose in Fund Scandal

Franklin Resources' Profit Jumps

Franklin Resources' Profit Jumps

Raytheon Swings to a Loss

Raytheon Swings to a Loss