U.S. shares rose on Wednesday and the dollar gained against the safe-haven Japanese yen as upbeat news out of Washington helped mitigate investors' concerns about North Korea's nuclear weapons tests and a major hurricane barreling towards Puerto Rico and Florida.

U.S. President Donald Trump and congressional leaders agreed to pass an extension of the debt limit until Dec. 15. The news also lifted the yield on benchmark 10-year Treasury notes after it had fallen to a near 10-month low at 2.054 per cent.

Trump and legislators also plan to pass a government funding bill and disaster aid for Hurricane Harvey victims, Democratic leaders said.

The Federal Reserve's Beige Book survey showed that economic activity expanded at a modest to moderate pace in July and August, helping stocks extend their gains.

The Dow Jones Industrial Average  rose 74.53 points, or 0.34 per cent, to 21,827.84, the S&P 500 gained 8.99 points, or 0.37 per cent, to 2,466.84 and the Nasdaq Composite added 19.90 points, or 0.31 per cent, to 6,395.47.

As risk aversion wore off during the day, gold retreated from its earlier rise. Spot gold <XAU=> dropped 0.4 per cent to US$1,332.81 an ounce. U.S. gold futures fell 0.49 per cent to US$1,337.90 an ounce.

As measured against a basket of major currencies, the dollar turned positive after having fallen on a Fed Beige Book survey that was weaker than expected and after Fed Vice Chairman Stanley Fischer said he would resign in October, many months before his term was due to end.

"This means a sea change in the composition of the Fed, especially as it's not clear if Fed Chair (Janet) Yellen is going to get renominated. The composition of the Fed is going to look entirely different than it did just a couple of years ago," said Subadra Rajappa, head of U.S. rates strategy at Societe Generale in New York.

The Japanese yen weakened 0.51 per cent versus the greenback at 109.36 per dollar.

The U.S. dollar hit a multi-year low against the Canadian dollar after the Bank of Canada surprised many by raising rates. It recovered slightly to stand at CUS$1.2220, down 1.22 per cent, after hitting a low of CUS$1.2140 earlier.

In Europe, a meeting on Thursday of European Central Bank policymakers is expected to yield clues as to when they will begin to scale back monetary stimulus.

"A lot will depend on how (ECB President Mario) Draghi addresses the euro," said Commerzbank currency strategist Esther Reichelt, in Frankfurt. "The question is whether he'll address it strongly enough for the market to react."

The pan-European FTSEurofirst 300 index rose 0.10 per cent and MSCI's gauge of stocks across the globe gained 0.15 per cent.

Even so, tensions remained high over North Korea's nuclear tests. Russian President Vladimir Putin said on Wednesday that resolving the crisis is impossible with sanctions and pressure alone.

In the Caribbean, dangerous Category 5 Hurricane Irma slammed across islands with pounding winds and raging surf en route to a possible landfall in Florida this weekend.

Oil prices rose as strong global refining margins and the reopening of U.S. Gulf Coast refineries provided a more bullish outlook after sharp drops due to Storm Harvey.

U.S. crude futures settled at US$49.16 per barrel, up 50 cents or 1.03 per cent. Brent  was last at US$54.16, up 1.46 per cent on the day.