Updated from 4:02 p.m. EST

Stocks erased early loses and closed higher Thursday after

National Semiconductor's


positive earnings and guidance eased concerns about a slump in the chip sector in the wake of warnings from two other companies late Wednesday.



gained 58.59 points, or 0.6%, to 10,552.82, having traded in negative territory at one point in the session; the


added 2.90 points, or 0.1%, to 2129.01, after falling more than 1% earlier in the day, and the

S&P 500

was up 6.43 points, or 0.5%, at 1189.24, about 2 points shy of its 40-month high touched a week ago.

On the Nasdaq, 2.3 billion shares traded, but decliners outpaced advancers by a 9-to-7 margin. On the


, about 1.6 billion shares changed hands, slightly more than the December average of about 1.58 billion. Advancing stocks beat out declining ones by 9 to 8.

In other markets, the 10-year Treasury note was down 15/32 with the yield up to 4.18%. The dollar advanced for the second day against the yen and euro, after having its biggest gain in two months Wednesday.

Oil futures closed higher, with the January contract adding 59 cents to $42.53 a barrel, amid concerns OPEC will cut production at its meeting Friday.

On the economic front, the Labor Department said jobless claims increased by 8,000 to 357,000 in the week ended Dec. 4. Many analysts were forecasting a 15,000 decrease.

In another report, the Commerce Department said U.S. wholesale inventories rose 1.1% in October. Economists had been expecting an increase of only 0.5%. The inventory-to-sales ratio remained at 1.15. Seasonally adjusted sales at wholesalers increased 1.6%.

"We have three things affecting us today: The chip stocks are guiding lower, the employment data weren't as good as expected, and oil is rising," said Larry Wachtel, senior market analyst with Wachovia Securities. "The bull market got overexpanded, so the market goes back and forth each day. Until we get into the second half of the month, where I think seasonalities will take effect, we won't progress past this measured pace."

At midday, National Semiconductor reported second-quarter earnings, saying it earned 21 cents a share on a GAAP basis, vs. 17 cents a year ago. Excluding items, the company earned 18 cents a share. Revenue was $448.9 million, down 18% from the previous quarter and 5% lower than a year ago. The company said third-quarter revenue would be flat to slightly down on a sequential basis. Shares rose 75 cents, or 4.7%, to $16.75.

The development was well-received, because after the bell Wednesday,


(XLNX) - Get Report

said it expects revenue to fall 5% to 8% from what it posted in its fiscal second quarter, as bookings in November came in weaker than expected. That forecast implies revenue ranging from $371.02 million to $383.12 million in the current quarter. Shares fell $1.01, or 3.3%, to $29.72.

Also, in its midquarter update,


(ALTR) - Get Report

said it expects fourth-quarter revenue to decline about 9% to 12% sequentially, vs. its October forecast for a decline of 1% to 5%. Shares fell $1.73, or 7.8%, to $20.42.

In other earnings news Thursday,

Eli Lilly

(LLY) - Get Report

confirmed fourth-quarter and full-year guidance. The drugmaker said it still expects EPS of 73 cents to 75 cents and $2.80 to $2.82, respectively, in line with the Thomson First Call consensus estimates of 74 cents and $2.81. Eli Lilly shares gained 22 cents, or 0.4%, to $54.56.



(COST) - Get Report

reported a higher first-quarter profit, earning 40 cents a share vs. 34 cents a year ago, matching estimates. Revenue rose 10% to $11.34 billion, a little less than expected. Shares fell 80 cents, or 1.6%, to $48.10.


(CIEN) - Get Report

reported a fourth-quarter loss of $495 million, or 87 cents a share, vs. $115 million, or 24 cents a share, in the same year-ago period. The results included a $371 million goodwill impairment. The company was upbeat about the future, saying it expects first-quarter revenue to increase by about 7% to 10% on a sequential basis. Ciena jumped 54 cents, or 23.1%, to $2.88.

Toll Brothers

(TOL) - Get Report

reported record fourth-quarter earnings of $180.6 million, or $2.22 a share, up from $1.19 a share in the year-ago period. Earnings easily beat the Thomson First Call forecast for $1.97 a share. Revenue for the homebuilder hit $1.46 billion, up 62% over last year. Toll Brothers was up $6.76, or 12.5%, to $60.87.



shares increased after the company was upgraded by Friedman Billings Ramsey to outperform from market perform. The broker also lifted its share target price to $4.60 from $3.75, citing the company's plan to finally report third-quarter results as well as a contract from



. Nortel rose 8 cents, or 2.1%, to $3.84.



raised its fourth-quarter dividend by 8.75 cents to 10 cents a share, payable on Feb. 1, 2005, for shareholders of record on Jan 3. The company also reaffirmed its first-quarter EPS target of 40 to 42 cents a share and 2005 full-year estimate of $1.88 to $1.98. Tyco gained 32 cents, or 0.9%, to $34.40.

Overseas markets closed mostly lower, with London's FTSE 100 down 0.3% to 4688 and Germany's Xetra DAX down 1.2% to 4150. In Asia, Japan's Nikkei fell 1.5% overnight to 10,776, while Hong Kong's Hang Seng rose 0.1% to 14,008.