Canada's trade surplus widened to C$5.3 billion ($4.1 billion) in May, as higher prices for energy products boosted exports and imports decreased.

The price of oil, one of Canada's major exports, rose after steep losses in the previous two sessions, as investors returned their focus to tight supply.

U.S. crude prices rose 2.5% to $100.98 a barrel, while the Canadian dollar was trading 0.2% higher at 1.3016 to the greenback, or 76.83 U.S. cents. It traded in a range of 1.2981 to 1.3055.

Gains for the loonie came as the U.S. dollar gave back some recent gains against a basket of major currencies and gains in chipmakers lifted stocks.

That helped calm investors after hawkish Federal Reserve comments increased the likelihood of a hefty interest rate hike later this month and raised fears over how much this could slow the economy.

The Canadian dollar will gain less ground than previously thought over the coming year as the growing risk of a global economic slowdown bolsters demand for safe-haven currencies such as the U.S. dollar, a Reuters poll showed.

Canadian government bond yields were mixed across a flatter curve, with the 10-year down nearly one basis point at 3.183%.

The Bank of Canada is due to auction C$3 billion of 10-year bonds on behalf of Canada's government. The bidding deadline is at 12 p.m. ET (1600 GMT).

Canada's employment report for June, due on Friday, could help guide expectations for a supersized interest rate hike next week by the central bank.

(Reporting by Fergal Smith; editing by Jonathan Oatis)