* Dollar recovers from weakness, euro nears $1.40
* Risk rally stalls as China stocks fall 5 percent
* U.S. durable goods fell more than expected in June
* Australian, Canadian dollars decline sharply (Updates prices, adds quotes, changes byline)
By Gertrude Chavez-Dreyfuss
NEW YORK, July 29 (Reuters) - The U.S. dollar climbed to a two-week high against the euro on Wednesday, as steep losses in Shanghai's stock market and an unexpectedly weak U.S. durable goods report reignited the greenback's appeal as a safe haven.
Falls in U.S. equities and a 5 percent slide in China's benchmark Shanghai Composite Index <
> sapped investors' appetite for risk. That helped the dollar index recover from its lowest level of 2009, pushed the euro to a two-week low near $1.40 and boosted the yen.Both the yen and dollar benefit in times of extreme risk aversion in the market.
"The dollar is moving with the ebb and flow of risk appetite," said Samarjit Shankar, director of global strategy at Bank of New York Mellon in Boston.
"Today, risk is off and the dollar is gaining. It started with the collapse in Shanghai stocks and people are wondering whether the foray into risk assets may have been overdone."
In early afternoon trading, the euro dropped more than 1 percent against the dollar to $1.4020 <EUR=> after hitting $1.4008, its lowest since July 15.
On Tuesday, the euro zone currency rose as high as $1.4303, its highest since early June, according to Reuters data.
The ICE Futures' dollar index, which measures its performance against a basket of six other major currencies, rose 0.9 percent to 79.524 <.DXY>, rebounding from a 2009 low of 78.315 set the previous day.
Adding to dollar strength was a government report showing new orders for long-lasting U.S. goods fell more sharply than expected in June, which further weighed on risk sentiment.
The Commerce Department said U.S. durable goods orders fell 2.5 percent in June, the largest drop since January and worse than market expectations for a 0.6 percent decline. For more see [
]."This has translated into a weak equity market and a pullback from dollar shorts in the currency market with the risk-off scenario playing out," said Andrew Busch, global FX strategist at BMO Capital Markets in Chicago.
The euro was last down 0.7 percent against the yen at 133.09 <EURJPY=R>, while the dollar rose 0.4 percent to 94.89 yen <JPY=>.
The latest Federal Reserve Beige Book survey, saying the U.S. recession has moderated, had little impact and failed to appease the market's already nervous mood. [
]Growing optimism about the global economic outlook had pressured the U.S. currency in recent weeks and fueled a rally in stocks, commodities and higher-yielding currencies.
But some disappointing U.S. earnings this week and a drop in U.S. consumer confidence have prompted investors to once again seek shelter in the dollar.
The Australian dollar fell 1.4 percent against its U.S. counterpart to US$0.8151 <AUD=>, while the New Zealand dollar declined 0.6 percent to US$0.6544 <NZD=>.
The Canadian dollar, which is particularly sensitive to oil prices, also fell, with the U.S. dollar up 0.9 percent at C$1.0905 <CAD=>. (Additional reporting by Wanfeng Zhou; Editing by James Dalgleish)