Stocks opened sharply lower for the session as Asian factories slowed and European output fell, but most of the losses evaporated after a report showed manufacturing activity expanded last month at its fastest clip in 20 months.
Consumer sentiment also rose in February as Americans turned more optimistic about the job market.
With $85 billion in government budget cuts set to begin, President Barack Obama blamed Republicans for failure to reach a compromise to avert the cuts, known as sequester. But the stock market appeared to have already priced in the failure by legislators to reach an agreement.
"We were able to dig out of that hole, but not make any great strides on it either," said Peter Jankovskis, co-chief investment officer at OakBrook Investments LLC in Lisle, Illinois. "We will probably be in a holding pattern pending some big development on a broader budget deal."
The Dow Jones industrial average <.DJI> gained 35.17 points, or 0.25 percent, to 14,089.66 at the close. The Standard & Poor's 500 Index <.SPX> added 3.52 points, or 0.23 percent, to 1,518.20. The Nasdaq Composite Index <.IXIC> advanced 9.55 points, or 0.30 percent, to 3,169.74.
For the week, the Dow rose 0.6 percent, the S&P 500 edged up 0.2 percent and the Nasdaq gained 0.3 percent.
The slight gains for equities came during a volatile week that saw markets decline on Monday after uncertain Italian elections, only to rebound in the next two sessions as Federal Reserve Chairman Ben Bernanke defended the central bank's stimulus measures.
The low interest rates due to the Federal Reserve's accommodative monetary policy have helped equities continue to attract investors. The Dow is less than 1 percent away from its all-time intraday high of 14,198.10. Declines have been shallow and short-lived, with investors jumping in to buy on dips.
Intuitive Surgical (>> Intuitive Surgical, Inc.) jumped 8.5 percent to $553.40 after Cantor Fitzgerald analyst Jeremy Feffer upgraded the stock, saying the stock's slide of more than 11 percent on Thursday was a gross overreaction to a news report.
Groupon Inc (>> Groupon Inc) surged 12.6 percent to $5.10 a day after the online coupon company fired its chief executive officer in the wake of weak quarterly results.
Gap Inc (>> The Gap Inc.) rose 2.9 percent to $33.87 after the clothing retailer reported fourth-quarter earnings that beat expectations and boosting its dividend by 20 percent, while Salesforce.com Inc (>> salesforce.com, inc.) posted sales that beat forecasts, driving its stock up 7.6 percent to $182.
Chesapeake Energy Corp (>> Chesapeake Energy Corporation) fell 2.4 percent to $19.67 after the U.S. Securities and Exchange Commission escalated its investigation into the company and its Chief Executive Aubrey McClendon for a controversial perk that granted him a share in each of the natural gas producer's wells.
Volume was modest with about 6.72 billion shares traded on the New York Stock Exchange, NYSE MKT and Nasdaq, slightly above the daily average of 6.5 billion.
Advancing stocks outnumbered declining ones on the NYSE by a ratio of about 17 to 13, while on the Nasdaq, seven stocks rose for about every five stocks that fell.
(Editing by Jan Paschal)
By Chuck Mikolajczak