Markets started lower, heading for a seventh day of losses out of the past eight trading sessions. Things turned around in early afternoon trading after congressional negotiators expressed optimism after talks at the White House about the prospects of resolving the so-called fiscal cliff.
Between Election Day and Thursday, the Dow Jones industrial average had given up 4.5 percent, or 594 points. The Standard & Poor's 500 is off 4.65 percent or 66 points since voters went to the polls. Similarly, the Nasdaq index has lost 5.6 percent or 168 points since the election.
Gains held Friday for only the second positive session since the election.
By close of trading, the DJIA added 45.93 points or 0.37 percent to 12,588.31. The tech-heavy Nasdaq composite index gained 16.19 points or 0.57 percent to 2,853.13. The S&P 500 tacked on 6.55 points or 0.48 percent to 1,359.88.
On the New York Stock Exchange, 2,287 stocks advanced and 800 declined on a volume of 4 billion shares traded.
The benchmark 10-year treasury rose 5/32 to yield 1.579 percent. Before polls opened Nov. 6, 10-year notes were yielding 1.689 percent.
The euro fell to $1.2743 from Thursday's $1.2782. Against the yen, the dollar rose to 81.31 from 81.17 yen.
In Tokyo, the Nikkei 225 index gained 2.2 percent, 194.44 points, to 9,024.16.
In London, the FTSE 100 index shed 1.27 percent, 72.16 points, to 5,605.59.
Yosemite climber falls 30 feet, suffers major injuries
Moore to attend retreat in to avoid Kutcher's wedding