NEW YORK U.S. stocks and oil prices gained on Friday on a rise in U.S. consumer sentiment to a more than five-year high, outweighing gloom that the "fiscal cliff" in the United States and Europe's economic woes may lead to a world recession.
Stocks later trimmed gains after President Barack Obama said any deal with Congress to avert a fiscal crisis must come with higher taxes on the wealthiest Americans.
U.S. Treasury bonds cut losses to trade almost flat on Obama's remarks, in which the newly re-elected president invited congressional leaders to the White House next week to start negotiating.
The so-called fiscal cliff, aimed at cutting the federal budget deficit, could take an estimated $600 billion out of the economy in automatic spending cuts and tax hikes, severely hindering economic growth.
"Clearly taxes are going up and that is something the market doesn't like. There is concern the economy continues to weaken, and there is not much left in the tank in terms of making corporate profitability better," said Stephen Massocca, managing director at Wedbush Morgan in San Francisco.
The surprisingly strong sentiment survey showed American consumers felt more optimistic about employment prospects and the economic outlook, according to a Thomson Reuters/University of Michigan index, easing the gloom from Europe.
The MSCI world equity index has lost more than 2 percent since Monday and looked set to close on Friday with a weekly decline that would be the steepest since June. The index was little changed at 323.37.
In late trading, the Dow Jones industrial average was up 12.65 points, or 0.10 percent, at 12,823.97. The Standard & Poor's 500 Index was up 4.39 points, or 0.32 percent, at 1,381.90. The Nasdaq Composite Index was up 14.63 points, or 0.50 percent, at 2,909.99.
European shares provisionally ended flat, paring losses on the U.S. data, which included a government report that wholesale inventories rose in September by the most in nine months. Inventories are a key element in the government's measure of economic growth.
The FTSE Eurofirst 300 index of top European shares closed down 0.05 percent at 1,097.18 after trading higher briefly before the market's close.
Falling industrial output in France, Italy and Sweden and a warning from a German ministry that Europe's largest economy was expected to slow further rattled investors.
Also weighing on investors was news that euro zone finance ministers are unlikely to release a new tranche of loans to Greece on Monday because there is no agreement on how to make its debt sustainable.
"It's the core Europe now, not just the peripheral Europe, that may be sliding into a recession," said Boris Schlossberg, managing director of FX Strategy at BK Asset Management in New York. "If that happens, then China will lose its export market and the whole global economy will begin to contract.
"The market is very afraid that Europe could drag the whole global economy down."
Oil pushed higher in choppy trading, lifted by the improved U.S. consumer sentiment and Chinese data indicating a strengthening economy.
U.S. crude futures gained 98 cents to settle at $86.07 a barrel, while Brent futures settled $2.15 higher at $109.40 a barrel.
The euro dropped to a two-month low against the U.S. dollar and could extend losses as fears mount that the euro zone's debt crisis and deteriorating economic conditions could drag on global economic growth.
The euro was down 0.23 percent at $1.2715 and was seen vulnerable to further losses. The dollar index rose 0.3 percent to 81.014.
Gold hit a three-week high of $1,738.66 an ounce before pulling back slightly. Spot gold prices rose 97 cents to $1,730.90.
Prices of safe-haven U.S. Treasuries slipped as stock gains sparked by improved consumer sentiment whetted investors' appetite for riskier assets.
The benchmark U.S. Treasury 10-year note fell 1/32 in price to yield 1.6148 percent.
(Reporting by Herbert Lash; Additional reporting by Richard Hubbard and Marc Jones in London; Ryan Vlastelica, Wanfeng Zhou and Chuck Mikolajczak in New York; Editing by Dan Grebler and Leslie Adler)