U.S. stock markets ended higher on Friday on hopes that politicians would find common ground to steer clear of the "fiscal cliff" that would hurt the U.S. economy, while escalating tensions in the Middle East boosted oil prices.
But shares on major markets still posted a second consecutive weekly loss as the collective worry about the U.S. government's fiscal problems and weak global economic growth weighed on sentiment.
Democrats said they recognized the need to curb spending and Republicans said they had agreed to put "revenue on the table" following a meeting with President Barack Obama.
"These are very small steps in the right direction," said Kate Warne, investment strategist at Edward Jones in St Louis. "The more evidence there is that Congress will make a decision sooner, the more likely we are to see stocks rebound."
Investors have been concerned that if no deal were reached to modify automatic spending cuts and tax hikes, the U.S. economy could slip into recession. The S&P 500 has dropped about 4 percent over the past two weeks, in part due to these worries.
The Dow Jones industrial average <.DJI> added 45.93 points, or 0.37 percent, to 12,588.31. The Standard & Poor's 500 Index <.SPX> rose 6.55 points, or 0.48 percent, to 1,359.88. The Nasdaq Composite Index <.IXIC> gained 16.19 points, or 0.57 percent, to 2,853.13.
For the week, the S&P was down 1.5 percent, its second week in a row in the negative. The Dow lost 1.8 percent, down for the fourth straight week, while the Nasdaq was lower for the sixth week, also off 1.8 percent.
The MSCI world equity index <.MIWD00000PUS> recovered in late trading to trade little changed at 317.64 but has lost 1.7 percent this week.
The FTSEurofirst 300 index <.FTEU3> of top companies shed 1.04 percent to 1,067.45 and posted its worst week since late September.
Benchmark Brent crude oil prices rose above $109 a barrel as a showdown between Israel and the Palestinians in Gaza stoked worries about supply. Investors were concerned that Arab producers may be drawn into any potential conflict, which could impact supply lines.
Adding to worries, a fire broke out at an oil and natural gas platform in the Gulf of Mexico, the U.S. Coast Guard said. It told local media the platform was not actively producing.
Brent crude rose 94 cents to settle at $108.95 a barrel. U.S. oil gained $1.22 to settle at $86.67.
The yen fell for a third day against the dollar and posted its worst weekly loss since mid-February as expectations of aggressive monetary easing from the Bank of Japan continued to curb the currency's appeal
Japanese Prime Minister Yoshihiko Noda paved the way for a snap election on December 16. The lower house of parliament was dissolved on Friday.
Shinzo Abe, leader of the main opposition Liberal Democratic Party and seen as likely to be Japan's next leader, on Thursday called for the country's central bank to adopt interest rates of zero or below to spur lending.
"The basic driver is still the interest rate differential between the dollar and yen, which is very narrow, and we have to wait for what happens after the (Japanese) elections," said Marcus Hettinger, global FX strategist at Credit Suisse in Zurich.
The U.S. dollar was up 0.2 percent at 81.26 yen.
The euro continued its downward drift as concerns over Greece's debt struggle and Europe's stagnant economy weighed. It was down 0.3 percent at $1.2739.
U.S. Treasury debt prices rose, with yields touching their lowest levels in over two months on skepticism over whether Washington will produce a deal to avoid a budget crisis and worries about fighting between Israel and the Palestinians.
The benchmark 10-year U.S. Treasury note was up 4/32 in price to yield 1.581 percent.
(Additional reporting by Leah Schnurr; Editing by Theodore d'Afflisio and Dan Grebler)