The Canadian dollar edged lower against its broadly weaker U.S. counterpart on Thursday as a drop in oil prices offset data showing that Canada's trade surplus widened in June.

The loonie was trading 0.1% lower at 1.2850 to the greenback, or 77.82 U.S. cents, after moving in a range of 1.2819 to 1.2876. It was the only G10 currency to lose ground against the U.S. dollar.

"The Canadian dollar is coming under pressure as a brutal wave of selling grips crude markets," said Karl Schamotta, chief market strategist at Corpay.

"With (crude) inventories surging as the summer driving season draws to a close, investors are betting prices could come down further in the months ahead."

U.S. crude oil futures settled down 2.3% at $88.54 a barrel, the lowest level since before Russia's invasion of Ukraine in February. Oil is one of Canada's major exports.

Canada's trade surplus widened to C$5.1 billion ($4.0 billion) in June, beating analyst expectations, as exports rose 2%.

Canada's employment report for July, due on Friday, could offer further clues on the strength of the domestic economy.

Analysts expect the loonie to rally over the coming year, betting the threat of recession will ease as the U.S. Federal Reserve and the Bank of Canada likely wind down rate-hike cycles in 2023, a Reuters poll showed.

Canadian government bond yields eased across a more deeply inverted curve. The 10-year was down 5 basis points at 2.669%, while it fell 4.7 basis points further below the 2-year to a gap of 51.2 basis points.