Blue-chip stocks managed to gain on Tuesday, but finished well below session highs fueled by a key index of manufacturing activity, which posted its largest gain in five years.

Technology shares fell, lead by software and semiconductor names, as investors gave thumbs down to Hewlett-Packard Co.'s proposed $20 billion takeover of rival Compaq Computer Corp.

The Dow Jones industrial average gained 47.74 points to end the day at 9,997.49, after gaining well over 200 at one point, while the technology-laced Nasdaq Composite Index lost 34.64 points at 1,770.79. The Standard & Poor's 500 Index dropped 0.65 at 1,132.93.  

``The trading community is just taking it one day at a time. They are not going to chase any false starts,'' said Tom Sparico, managing director of equities at broker/dealer Bengal Partners. ``Trying to pick bottoms is just not a profitable business. It's truly like trying to catch knives.''

The National Association of Purchasing Management's index, a key manufacturing gauge, posted its most significant gain in five years in August as new orders and factory production both rose, suggesting the ailing industrial sector may have endured the worst of a more than year long slump. 

The NAPM index rose to 47.9 in August from 43.6 in July, well above economists' forecasts of a 43.9 reading. 

A reading under 50 signals that manufacturing activity -- more than one-sixth of the overall economy -- is contracting, and the NAPM index has now held below 50 for 13 straight months. 

But August's reading was the best since November 2000 and put the index solidly above a decade low of 41.2 in January.

The surprisingly strong gain pushed up the Dow more than 2 percent. But the powerful rally faded in the late afternoon, as investors focused again on weak corporate profits and failed previous rallies.

Investors refused to place long-term bets after a dismal August when shrinking profits and massive layoffs pushed leading market indexes precariously close to the two-year lows hit in April. The Standard & Poor's 500 index, a broad gauge of the stock market, typically has its worst month in September, according to market research firm MarketHistory.com. 

``Everybody is so distrustful,'' said Donna Van Vlack, director of trading at Brandywine Asset Management, which oversees $7 billion. ``Every time you want to believe, you get your head handed to you. How many fingers and toes do you have to have bitten off before you just say, 'Give me a little more proof.'''

In a day filled with merger-related corporate news, foremost in the headlines was Hewlett-Packard Co.'s agreement to acquire Compaq Computer Corp. more than $20 billion in stock. 

But the market looked skeptically at the combination, driving H-P shares down $4.34, or nearly 19 percent, at $18.87, and taking scalping 10.3 percent, or $1.27, off Compaq, which finished New York Stock Exchange trade at $11.08.

Their rivals managed to move higher. International Business Machines Corp. gained $1.49 to $101.49. Dell Computer Corp. rose 93 cents to $22.31. 

Sanmina Corp. slumped $2.03 to $15.98 after the electronics manufacturer warned its results will fall far short of expectations as the global slowdown in technology spending drags on.

Also weighing on tech stocks were signs that semiconductor sales have continued to slide. Chip sales worldwide dropped more than 37 percent in July, hit by slowing economic activity and bloated inventories, the Semiconductor Industry Association said on Tuesday. 

Still, the problem of excess inventories would be corrected in the September quarter, as efforts to cut down inventories accelerated in the second quarter, the association said. 

The Philadelphia Semiconductor index dropped 0.35 percent. 

Mergers in the energy industry also kept Wall Street on its toes. 

Devon Energy Corp. dropped $2.41 to $43.86 on its plans to buy Canada's Anderson Exploration Ltd. for $3.4 billion, the latest in a raft of takeovers of big Canadian energy firms by U.S. companies. Anderson surged $8.34 to $25.41, a jump of almost 49 percent. 

Santa Fe International Corp. agreed to buy Global Marine Inc. in a $3 billion stock-swap deal, creating the world's second-largest offshore oil and natural gas driller. Global Marine rose 60 cents to $15, while Santa Fe fell $2.32 to $22.98. Johnson & Johnson, a Dow component, rose $3.44 to $56.15 after researchers told a meeting of the European Society of Cardiology that an antibiotic-coated stent, developed by J&J, completely prevented re-clogging of coronary arteries during a seven-month period, 

Stocks for rival medical device makers slipped. Novoste Corp. plunged $8.23 to $10.02. 

Telecommunications stocks took a hit after Swedish telecom giant Ericsson, which is currently undergoing a restructuring, said it expects total capital expenditure for the telecoms market in 2001 and 2002 to be below last year's level. 

Ericsson dropped 97 cents to $4.01. Finnish cellular phone maker Nokia Corp. lost 74 cents to end at $15.

Advancing issues led decliners 8 to 7 on the New York Stock Exchange. Volume came to nearly 1.40 billion shares, ahead of the 1.14 billion Friday. 

The Russell 2000 index dropped 1.60 to 466.96.

In overseas markets, stocks edged higher after word of Hewlett-Packard's proposed purchase of Compaq. Japan's benchmark Nikkei rose 3.49 percent to 10,772.59 as computer-related stocks rose. 

In Europe, Germany's DAX index rose 1.5 percent, Britain's FT-SE 100 advanced 1.3 percent, and France's CAC-40 rose nearly 1.0 percent.

Reuters and the Associated Press contributed to this report.