Stocks rose most of the day on positive news about car sales, home prices and manufacturing. But major indexes turned lower after 1:40 p.m. Eastern Daylight Time after news emerged that Egypt's military had drawn up plans to suspend the country's constitution, dissolve its legislature and set up an interim government. Millions of protesters are demanding the ouster of President Mohammed Morsi.
The price of oil climbed close to $100 a barrel on concern that the crisis in the largest Arab nation could disrupt the flow of crude from the region.
"It's more or less Egypt unrest," said Sal Arnuk, co-founder of Themis Trading, a brokerage firm that specializes in stocks. "These very large protests are being televised and broadcast — that's spooking people."
The Standard & Poor's 500 index had climbed as much as 9 points shortly before midday. It then fell as much as 8 points before closing down 0.88 point, or 0.1 percent, at 1,614.08
Trading activity was lighter than normal, influenced by the upcoming July 4 holiday. The stock market will close at 1 p.m. on Wednesday, ahead of the Independence Day holiday on Thursday. The market re-opens Friday.
Crude oil jumped about $1 a barrel after news emerged of the worsening political situation in Egypt. Oil closed up $1.61 at $99.60 a barrel in New York. It last crossed $100 on Sept. 14 of last year.
The market's early gains were driven by a number of strong economic reports.
U.S. June auto sales reached their highest level since 2007. That helped lift Ford'sstock 44 cents, or 2.8 percent, to $16.18.
U.S. factory orders rose in May, helped by a third straight month of stronger business investment.
Also, U.S. home prices jumped 12.2 percent in May from a year earlier, the most in seven years, according to real estate data provider CoreLogic. The increase suggests the housing recovery is strengthening.
When trading resumes Friday, investors will turn their attention to a key gauge of the economy — the government's monthly employment report.
Economists forecast that the U.S. economy added 165,000 jobs in June, according to data compiled by FactSet. The Dow surged 200 points June 7 after the Labor Department said that U.S. employers added 175,000 jobs in May. The Federal Reserve has said the jobs market will be critical in determining when it ends its bond buying, which has kept interest rates low and driven a surge in stocks this year.
Investors and traders are also starting to think about corporate earnings, which begin in earnest next week. While corporate profits have reached record levels, most of the gains have come from cutting costs rather than increasing sales.
"We're in the middle of a transition," said Chris Wolfe, chief investment officer at Merrill Lynch Private Banking and Investment Group. "You would expect to see, over the balance of this year and going into next year, somewhat stronger macroeconomic data that translates directly into stronger corporate revenue growth."
Alcoa, the first company in the Dow to report earnings, will release its second-quarter results after the market closes July 8.
In government bond trading, the yield on the 10-year Treasury note was unchanged at 2.48 percent.
In other trading, the price of gold fell $12.30, or 1 percent, to close at $1,243.40 an ounce.
Among stocks making big moves:
— Zynga jumped 20 cents, or 6.5 percent, to $3.27 after the troubled maker of "FarmVille" and other online games said CEO Mark Pincus would step aside. The company's stock is down almost 70 percent since its 2011 initial public offering at $10 per share.
— Achillion Pharmaceuticals fell $2.10, or 25.1 percent, to $6.26 after the drug developer said regulators Monday placed a hold on an early-stage study involving its potential hepatitis C treatment.
— DaVita HealthCare Partners fell $7.15, or 5.9 percent, to $114, after the government proposed cutting the rates of Medicare payments to dialysis service providers.