Stocks edged higher Wednesday after a surprisingly strong report on hiring by private companies raised hopes that the job market may be improving.
Traders remained concerned about the latest spike in oil prices as Libya's internal conflict deepened. Crude settled above $102 a barrel for the first time since Sept. 2008. Worries about the impact of high oil prices on the U.S. economy have rattled markets over the past week.
Payroll processor ADP said private employers added 217,000 jobs last month, well above the 180,000 analysts had predicted. That raised hopes that the government's employment report coming up Friday could show a decline in the unemployment rate, which is currently 9 percent.
The Federal Reserve also reported that the U.S. economy expanded broadly over the last two months. All 12 regions covered by the survey reported "modest to moderate" growth, including a pickup in retail sales.
The Dow Jones industrial average rose 8.78 points, or 0.1 percent, to close at 12,066.80.
The S&P 500 rose 2.11, or 0.2 percent, to 1,308.44. Both the Dow and the S&P 500 wavered between gains and losses throughout the day.
The Nasdaq composite gained 10.66 points, or 0.4 percent, to 2,748.07.
The escalating conflict in Libya resulted in a surge in crude oil prices over the last week and volatility in global financial markets. U.S. stocks fell sharply on Tuesday after Federal Reserve Chairman Ben Bernanke said that higher oil prices could threaten the pace of the economic recovery
"When you look at the stock market any given day it's hard to isolate cause and effect, but today we don't have that problem," said Lawrence Creatura, a portfolio manager at Federated Investors. "Investors will have one eye on oil prices for quite some time."
Retail companies reported mixed earnings reports before the market opened. Costco Wholesale Corp. fell 2.5 percent after reporting earnings that met expectations.
Apple Inc. rose almost 1 percent after the company's CEO, Steve Jobs, briefly emerged from a medical leave to introduce the second generation of its iPad tablet computer.
Rising stocks outnumbered falling ones two-to-one on the New York Stock Exchange. Consolidated trading volume was 4.2 billion shares.