* Oil rise after U.S.-Polish missile accord angers Russia
* U.S. stocks rise on energy shares, HP's strong results
* Dollar gains, bolstered by deteriorating world outlook
(Adds close of U.S. markets)
By Herbert Lash
NEW YORK, Aug 20 (Reuters) - Oil prices rose on Wednesday after Russia snapped at a U.S. missile shield agreement with Poland, while a gloomy economic outlook outside the United States helped the dollar resume a march toward 2008 peaks.
U.S. stocks gained on a rise in energy shares and strong results from Hewlett-Packard <HPQ.N>, raising hope that demand abroad would support technology spending.
U.S. government debt prices rallied in a safe-haven bid driven by worries about American mortgage finance giants Fannie Mae <FNM.N> and Freddie Mac <FRE.N>, but global stocks shrugged off those concerns to move higher.
Oil rose slightly after Russia's angry response to the U.S.-Polish accord raised the threat of a supply disruption from the huge energy producer.
The jump in oil reversed earlier losses that were triggered by a U.S. government report showing the biggest weekly increase in U.S. crude inventories since 2001, thanks to a rebound in imports delayed by Tropical Storm Edouard.
Financial stocks rebounded after Tuesday's sell-off, helping lift along with energy shares the Dow and S&P 500.
"Going into the day some reasonably good earnings gave us a positive bias, and also it seems to me that the commodity stocks, which have been pretty beaten up, are having a very strong rebound," said Eric Kuby, chief investment officer at North Star Investment Management in Chicago.
Uncertainty surrounding a potential bail-out by the U.S. Treasury of Fannie and Freddie kept investors on edge.
Freddie stock slumped nearly 22 percent to $3.25, the lowest since 1990, and Fannie shares slid 27 percent to $4.40, the lowest since 1988.
Investors fear a collapse of Fannie and Freddie could add to risks of an already battered financial system, potentially exacerbating the U.S. housing slump and global credit crisis.
The Dow Jones industrial average <
> rose 55.20 points,or 0.49 percent, at 11,403.75. The Standard & Poor's 500 Index <.SPX> added 6.12 points, or 0.48 percent, at 1,272.81. The Nasdaq Composite Index < > gained 1.99 points, or 0.08 percent, at 2,386.35.Bond market gains were capped by rising stock markets, where investors snapped up shares of technology companies after Hewlett-Packard reported a strong profit and outlook.
HP posted its biggest one-day rise in six months after the computer company said quarterly profit leaped by 14 percent, raising hope that overseas demand would support technology spending even as the U.S. economy slows.
HP shares rose 5.7 percent to $46.16.
European stocks added to gains in late trading, propelled by a rally in heavyweight energy and mining stocks. Recently battered banking shares also trimmed losses.
Miners Rio Tinto <RIO.L> rose 7.4 percent, and BHP Billiton <BLT.L> and Kazakhmys <KAZ.L> each gained 6.7 percent.
Heavyweight oil shares BP <BP.L>, Total <TOTF.PA> and Shell <RDSa.L> also gained, as oil traded higher for much of the European session, though crude closed lower at the end.
The pan-European FTSEurofirst 300 <
> index ended up 0.5 percent at 1,165.31 points, with commodities the top four percentage gainers on the benchmark.The dollar index <.DXY> firmed after retreating much of the New York session on Tuesday, as investors took profits following a 2008 high hit earlier that day on global markets.
The dollar rose against major currencies, with the U.S. Dollar Index <.DXY> up 0.24 percent at 76.936. Against the yen, the dollar <JPY=> was down 0.08 percent at 109.78.
The euro <EUR=> rose 0.31 percent at $1.4741.
Traders resumed buying the dollar, with some saying the rise was more a result of short-term position adjustment than anything else after nearly two weeks of unbroken gains.
"We're seeing this slightly bid tone in the U.S. dollar, but there's no real direction in the market. It's just uninspiring," said C.J. Gavsie, managing director for foreign exchange sales at BMO Capital Markets in Toronto.
"Nothing has changed fundamentally" and the same concerns about Europe and other economies over the past month continue to undermine non-U.S. dollar currencies, Gavsie added.
Longer-dated euro zone government bonds rebounded with the 10-year futures briefly hitting a fresh 3-month high in another thinly traded session that analysts said exaggerated moves.
But with no major euro zone or U.S. economic data, and little impetus from steadier European and U.S. equities, technical factors were once again the dominant driver.
The benchmark 10-year U.S. Treasury note <US10YT=RR> rose 12/32 to yield 3.80 percent. The 30-year U.S. Treasury bond<US30YT=RR> rose 14/32 to yield 4.45 percent.
U.S. crude futures <CLc1> rose 45 cents to settle at $114.98 a barrel while London Brent <LCOc1> rose $1.11 to $114.36 a barrel.
U.S. gold futures ended a tad lower, whipsawed by higher crude prices and a stronger dollar, but analysts said they have yet to see a sign of gold's market bottom.
The December contract for gold <GCZ8> settled down 50 cents at $816.30 an ounce in New York.
Most Asian stock markets edged higher, rebounding from a two-year low, as cheap valuations proved irresistable and market chatter increased about fiscal stimulus in China.
The Asia-Pacific ex-Japan index <.MIAPJ00000PUS> rose 1.25 percent, but Japan's Nikkei share average <
> fell 0.1 percent in a choppy sesssion dragged lower by exporters. (Reporting by Ellis Mnyandu, Chris Reese, John Parry, Gertrude Chavez-Dreyfuss, Frank Tang in New York and Ian Chua, Sitaraman Shankar, Ikuko Kao and Alex Lawler in London) (Writing by Herbert Lash. Editing by Richard Satran)