Updated from 4:05 p.m. EDT

Stocks reversed earlier losses to end slightly higher Thursday, as investors largely ignored some weak economic data and discouraging corporate news.

The Dow Jones Industrial Average ended up 2 points at 9041, while the Nasdaq rose 11 points to 1646. The S&P 500 gained 4 points to 990. All three major averages had posted modest losses earlier.

"It's a bull market and they're buying every dip," said Peter Blatchford, equity trader at Miller Tabak & Co. "There's just incredible resilience." Blatchford said the strength is surprising, given recent economic data. "They're discounting a big turn and it makes no sense."

Initial jobless claims unexpectedly rose to 442,000 in the week ended May 31, from a revised 426,000 the previous week. Economists had expected a decline in new claims.

"While we're getting mixed data from other sectors suggesting that the economy is stabilizing, there are very little signs of any pickup in job growth," said Gerald Cohen, senior economist at Merrill Lynch.

The employment report for May will be released Friday, and Cohen said he is looking for payrolls to decline by 60,000, with the unemployment rate inching up to 6.1%. Miller Tabak's Tony Crescenzi said if Friday's data shows a loss of several hundred thousand jobs, he believes there is a 60% chance that the Fed will cut rates before the next scheduled meeting.

The European Central Bank slashed rates by 50 basis points Thursday to 2%, representing the lowest level for the region in more than 50 years and the lowest since the ECB was created.

In other economic news, U.S. factory orders for April came in below projections, falling 2.9% compared with a 2.1% increase in March. Economists were expecting a negative reading of just 1.8%.

"Considering jobless claims were nothing short of atrocious, it's very impressive that the market has been hanging in as well as it has," said Art Hogan, chief market analyst at Jefferies & Co. "People are still betting that the economy will get better in the second half, that we can have a jobless recovery."

Thursday's gains were particularly impressive given the recent move up. The Dow and S&P 500 have rallied for the past four days and the Nasdaq was up for two straight days going into Thursday's session. Since hitting a low on March 12, the Dow is up about 22%, the S&P is up about 25% and the Nasdaq has surged 30%.

In corporate news, Albertson's ( ABS) posted some weaker-than-expected earnings, citing "worsening economic conditions" and intense competition. The second-largest U.S. supermarket chain also sees full-year earnings falling below market expectations. Shares were down almost 12%, or $2.64, at $19.18.

Microsoft ( MSFT) CEO Steve Ballmer told his staff on Wednesday that competition from rival Linux, a maker of free software systems, and weaker technology spending by companies were creating a challenging environment for the software giant. Some observers were expressing worries that the company could delay the launch of its new operating system, Longhorn. Microsoft shares were down 3.6%, or 90 cents, at $24.09. VA Linux ( LNUX) was up 41%, or 62 cents, at $2.16.

Chipmaker Intel ( INTC) will update investors in a midquarter report Thursday. There is some concern the company will say sales will be lower than expected because of weakness in Asia. Shares were down 1.8%, or 38 cents, at $21.84.

On a positive note, warehouse-retailer Costco ( COST) said it sees June sales rising by 3% to 5% from the previous year. On Thursday the company said same-store sales rose 4% in May. The world's biggest retailer, Wal-Mart ( WMT), said May sales at U.S. stores open at least a year rose 2.1%, within the company's estimates, helped by pet supplies and plant sales. Investors will also get May sales for other major retailers throughout the day. Shares were up 1.4%, or 76 cents, at $54.62.

Xerox ( XRX) was up 0.2%, or 2 cents, at $11.45 after the Securities and Exchange Commission said six former Xerox executives, including two former CEOs of the firm, paid $22 million to settle a civil fraud case. Xilinx ( XLNX) and Maxim ( MXIM) also retreated after their earnings and revenue forecasts failed to inspire investors.

The NYSE said it will bar its top officials from serving as directors of NYSE-listed companies and will disclose the pay of top Big Board officials.

Shares of Martha Stewart Living ( MSO) were up 1%, or 13 cents, at $10.13 after Stewart resigned from her company following her indictment on securities fraud charges.

Procter & Gamble ( PG) was down 1%, or 99 cents, at $91.38, even though the company said it expects to meet analysts' profit estimates in the June quarter.

Rite Aid's ( RAD) former Chief Financial Officer Franklyn Bergonzi pleaded guilty to conspiracy and agreed to cooperate with federal prosecutors in their securities-fraud case. Shares were up 2%, or 7 cents, at $3.74.

Among analyst actions, Johnson & Johnson's ( JNJ) 12-month target price was cut to $49 from $59 at Morgan Stanley on worries about the distribution of its Cypher stents for heart patients and fierce rivalry from biotechnology player Amgen ( AMGN).

London's FTSE 100 was down 0.5% at 4104, and Germany's Xetra DAX was down 1.3% at 3039. In Asia, Japan's Nikkei closed 1.2% higher at 8657, while Hong Kong's Hang Seng lost 0.3% to 9639.

The euro was higher against the dollar following the ECB cut. The greenback was also weaker against the yen. Treasuries were slightly lower, with the yield on the 10-year note rising to 3.35%. Nymex crude oil prices for future delivery were up 69 cents at $30.74.

On Wednesday, the Dow closed up 116 points, or 1.3%, at 9039, while the Nasdaq climbed 31 points, or 1.9%, to 1635. The S&P 500 advanced almost 15 points, or 1.5%, to 986

More from Markets

Oil Slumps, Gas Spikes Ahead of Holiday Weekend; Assessing the Chipmakers--ICYMI

Oil Slumps, Gas Spikes Ahead of Holiday Weekend; Assessing the Chipmakers--ICYMI

Week Ahead: Wall Street Looks to Jobs Report as North Korea Meeting Less Certain

Week Ahead: Wall Street Looks to Jobs Report as North Korea Meeting Less Certain

Dow and S&P 500 Decline, Energy Shares Fall as U.S. Crude Oil Slides 4%

Dow and S&P 500 Decline, Energy Shares Fall as U.S. Crude Oil Slides 4%

Replay: Jim Cramer on the Markets, 10-Year Yield, Oil Prices and Foot Locker

Replay: Jim Cramer on the Markets, 10-Year Yield, Oil Prices and Foot Locker

Video: You Could Live in a Ritz-Carlton or St. Regis Home

Video: You Could Live in a Ritz-Carlton or St. Regis Home