* C$ at C$0.9822 to US$, or $1.0181 * Currency helped by strong U.S. housing report * Moody's keeps Spain at investment grade, boosts sentiment * Bank of Canada's less hawkish tone limits C$ gains By Alastair Sharp TORONTO, Oct 17 (Reuters) - The Canadian dollar firmed against the U.S. currency on Wednesday after data showed the budding recovery in the U.S. housing sector is gaining traction. Spain's avoidance of a rating downgrade also boosted sentiment, though gains were limited by a recent speech by Bank of Canada Governor Mark Carney, which investors have interpreted as being less hawkish on interest rates. The Canadian currency hit C$0.9818 to the U.S dollar, or $1.0185, soon after the release of data showing groundbreaking on new U.S. homes in September surged at its fastest pace in more than four years. Evidence of a recovery in the U.S. housing market helped the Canadian dollar because most of the country's exports, from building materials to oil, go to its southern neighbor. The currency held most of its gains by 10:43 a.m. (1443 GMT), trading at C$0.9822 to the greenback, or $1.0181, compared with C$0.9868 at Tuesday's North American close. Still, some traders noted the move higher was less sharp than it could have been and said the currency could struggle to move past C$0.9810. "Unless we see asset markets really box on in a major way from here, the reaction to what were very good numbers suggests that we're in for a day of consolidation," said Shane Enright, executive director of foreign exchange sales at CIBC World Markets. SPAIN HELPS, CARNEY WEIGHS Credit rating agency Moody's affirmed Spain's investment grade rating late on Tuesday, assuaging widespread fears that Spain could be cut to "junk" status, although Moody's based its decision on the assumption that Madrid would ask for help in holding down its borrowing costs. "Stronger risk appetite on the back of Moody's decision not to downgrade Spain is pretty much lifting all risk assets, the Canadian dollar is one of those," said Benjamin Reitzes, senior economist and foreign exchange strategist at BMO Capital Markets. "That's why you're getting some strength, not to the same extent as some other currencies, that's probably a lingering impact from Carney's speech the other day." The Canadian currency hit an almost two-week low against the greenback on Tuesday as investors digested a speech by Carney in which he did not reference a central bank intention to hike rates once conditions allow. Canada's dollar was weak against other major currencies on Wednesday, as both the Australian dollar and euro made broad-based gains. The Canadian currency fell to an almost four-month low of C$1.2941 versus the euro, or 77.27 euro cents, and a more than three-month low against the Swiss franc. It was at C$1.0193 versus the Australian currency, or 98.11 Australian cents, its weakest level since Oct 1. The pair often move in tandem as both Canada and Australia are natural resource exporters. Highlighting the move away from safe haven assets, prices of Canadian government bonds fell broadly, with the two-year bond off 4 Canadian cents to yield 1.100 percent, while the benchmark 10-year bond fell 43 Canadian cents to yield 1.870 percent.