Adding to economic concerns, electronics retailers Circuit City Stores Inc. and Best Buy Co. Inc. issued downbeat outlooks for the first half. Circuit City cited "macroeconomic headwinds" such as higher energy prices, the housing market and the volatility in subprime lending.
But "while the day's economic news was disappointing, easing tensions between Iran and the West seems to have inspired some buying in the equity markets," said Frederic Ruffy, analyst at Optionetics.
The market received an early boost from stumbling oil prices after Iran said it will release 15 British naval personnel it had captured in Gulf waters. Iran is the world's fourth largest producer of crude oil.
The Dow Jones Industrial Average reversed early losses and finished up 19 points at 12,530, marking its fifth straight session of gains.
"Market action [was] a bit erratic," said Mike Malone, trading analyst at Cowen & Co, noting that stocks first fell after the economic reports before staging only a mild recovery.
Microsoft Corp. led the gains on the Dow, rising 2.3% after Citigroup lifted its earnings estimates for the software giant. Altria Group Inc. , Home Depot Inc. , and Honeywell International Inc. also advanced strongly.
General Motors Corp. was the worst performer on the Dow, losing 1.4% after DaimlerChrysler AG said it's in talks with "interested parties regarding future options" for its unit Chrysler.
AT&T Inc. also fell 1.3% amid reports that it's angling to acquire a stake in the parent company of Italian carrier Telecom Italia SpA for roughly $1.74 billion.
The S&P 500 rose 1.6 points to 1,439, while the Nasdaq Composite gained 8.4 points to 2,458, also marking its fifth straight session of gains.
Positive sentiment for the technology sector was boosted after brokerage Stifel Nicolaus upgraded semiconductor equipment makers to overweight from neutral. Company-specific upgrades included Cymer Inc. , KLA Tencor Corp. and Phototronics . Shares of Applied Materials also rose 1.6%.
In telecoms, Global Crossing gained 4% after Deutsche Bank upgraded the firm to buy from hold, citing valuation.
Trading volumes showed 1.4 billion shares exchanging hands on the New York Stock Exchange and 1.7 billion on the Nasdaq stock market. Advancing issues outpaced decliners by 17 to 14 on the NYSE, while decliners outpaced gainers by 15 to 14 on the Nasdaq.
By sector, metals mining stocks and semiconductors led the gains, while banks , insurance and transportation fell.
Crude futures fell sharply just before the stock market opened as Iran's leader said that the 15 detained British sailors would be freed. Oil had surged past $66 a barrel after the sailors were captured 13 days ago.
Oil recovered some ground but still finished down 26 cents at $64.38 a barrel following weekly inventory data.
Investors were also consolidating the strong gains from the previous session, when the market also cheered falling oil prices as tensions between the UK and Iran began to ease. "Expectations were that the situation was going to be resolved anyway," said Cowen's Malone.
On Tuesday, stocks staged a vigorous rally, with the Dow industrials rising nearly 130 points to a five-week high. .
Economic reports fall short of expectations
The market faced pressure soon after the open on Wednesday as investors weighed new data on employment, the service sector of the economy and factory orders.
The national survey by Automatic Data Processing suggested payrolls grew by 130,000 in March. The Labor Department will report on the March figures on Friday. Economists surveyed bMarketWatch expect a gain of about 168,000 jobs.
In addition, nonmanufacturing sectors of the U.S. economy expanded at a slower pace during March, the Institute for Supply Management reported Wednesday. The ISM nonmanufacturing index fell to 52.4% from 54.3% in February. Economists were looking the index to rise to 55%.
Finally, factory orders rose 1% in February, less than the 1.9% expected by Wall Street. Excluding transportation equipment, orders fell 0.4%.
Earnings to follow long weekend
Investors also positioned themselves ahead of a long weekend. The stock market will be closed on Friday for the Good Friday Holiday. Next week also officially marks the start of the first-quarter earnings season, which is expected to show earnings growth slowing.
"Expectations are that earnings will slow along with economic growth," said Cowen's Malone.
Already on Wednesday, earnings from two electronics retailers provided a mixed picture of consumption.
Best Buy Co.'s fourth-quarter earnings report met expectations, but the retailer said it is anticipating margin pressure.
Circuit City reported a fourth- quarter loss due to the costs of closing some stores and also expects to take a loss in the first half. The outlook reflects economic pressures on consumers, said chief executive Philip Schoonover in a conference call.
"Frankly, we've seen macroeconomic head winds, including higher energy prices, slower housing sales, impact of the volatility in subprime lending rates, and declining consumer confidence that we believe in combination with our internal changes will contribute to a significant loss in the first half," he said.
Treasurys rose after the weak data. The benchmark 10-year Treasury note gained 5/32 at 99-26/32 with a yield of 4.666%.
Gold futures rose $7.70 to close at $677.40 an ounce, lifting the likes of Newmont Mining and Randgold Resources .
The dollar traded lower against the euro and yen early Wednesday after mixed interpretations of the ADP data in the currency markets.
The auto sector was again in focus. DaimlerChrysler Chief Executive Dieter Zetsche, in a statement coinciding with the annual shareholder meeting in Berlin, said the company is in talks with "interested parties regarding future options" for Chrysler. He didn't say who those partners were, or otherwise tip his hand about the negotiations, saying the firm needs "maximum scope for maneuver."
Elsewhere, Monsanto gained 3.2% after posting a higher profit for the second quarter.
Bristol Myers Squibb and ImClone Systems said a 400-patient first-line Phase III study of Erbitux plus platinum-based chemotherapy met the primary endpoint of increasing overall survival in patients with recurrent and metastatic squamous cell carcinoma of the head and neck.
By Nick Godt