* TSX rises 9.84 points, or 0.08 percent, to 12,306.93 * Five of 10 main sectors decline * BlackBerry slips after analyst report By John Tilak TORONTO, July 10 (Reuters) - Canada's main stock index advanced on Wednesday to its highest in three weeks as investor sentiment improved after U.S. Federal Reserve meeting minutes suggesting a balanced stimulus pullback, offsetting weak trade data out of China. The Toronto market extended its gains to a third straight session as it received help from shares of energy producers and retailer Alimentation Couche-Tard. Investors closely watched as China, a big consumer of Canada's commodity exports, warned of a "grim" outlook for trade after a surprise fall in June exports, raising fresh concerns about the extent of the slowdown in the world's second-largest economy. But the market's big focus was on monetary policy as consensus built within the Federal Reserve in June about the likely need to begin pulling back on economic stimulus measures soon, while many officials wanted more reassurance the employment recovery was on solid ground before a policy retreat. "The Fed is very methodically correcting some of the overreaction that we're seeing," said Karl Schamotta, senior market strategist at Western Union Business Solutions. "I don't think they want to rock the boat intentionally," he added. "(But) ... they want to put a ceiling on the froth in the market because that froth is unsustainable." Schamotta expects the Fed to support the economy without undoing the reforms the central bank has been putting into play. The Toronto Stock Exchange's S&P/TSX composite index closed up 9.84 points, or 0.08 percent, at 12,306.93. Five of the 10 main sectors on the index were higher. Leading the gains were shares of energy companies, which jumped 0.7 percent after oil prices surged. Canadian Natural Resources Ltd rose 2.2 percent to C$32.67, and Suncor Energy Inc was up 0.5 percent to C$32.14. Couche-Tard rallied 6.3 percent to C$62, a day after the stock tumbled on weaker-than-expected quarterly results. BlackBerry lost 3.9 percent to C$9.80 after an analyst report said initial sales of its new mid-tier Q5 device were weak in the United Kingdom, while sales of its other BlackBerry 10 handsets remained lackluster. The decline comes a day after the smartphone maker faced tough questions about its future at its annual general meeting. Financials, the index's most heavily weighted sector, lost 0.1 percent. Royal Bank of Canada, the country's biggest lender, gave back 0.5 percent to C$61.23, and Bank of Montreal < BMO.TO> fell 0.6 percent to C$62.20. The materials sector, which includes mining stocks, slipped 0.2 percent. Miner Teck Resources Ltd was down 2.5 percent at C$21.84.