OTTAWA- Canada unexpectedly posted a trade surplus of C$3.23 billion ($2.58 billion) in June, the largest in almost 13 years, as exports jumped on higher shipments of oil and autos, Statistics Canada data indicated on Thursday.

Analysts polled by Reuters had forecast a trade deficit of C$0.68 billion in June. The surplus was the largest since the C$3.45 billion recorded in September 2008.

Exports leapt by 8.7%, the biggest increase since July 2020, to hit a record high C$53.76 billion as economies continue their recovery from the COVID-19 pandemic.

"This is a very pleasant surprise," said Peter Hall, chief economist at Canada's export development agency.

"International supply chains are becoming less encumbered and ... fundamental underlying demand that has been with us all the way along is actually manifesting itself in growth," he said by phone.

The value of crude oil exports rose by 25.7% on higher volumes after a slowdown in production in April and May.

Exports of motor vehicles and parts - hobbled in recent months by a shortage of computer chips - rose by 14.9% but remain more than 8% lower than in June 2020.

"The auto sector is still struggling to cope with shortages and, with energy exports now close to a record high, the scope for further gains is limited," Paul Ashworth of Capital Economics said in a note.

The shortages also helped cut imports of autos and parts, which fell 3.8%. Overall imports dipped by 1.0%.

Royce Mendes, senior economist with CIBC, said in a note that exports of goods and services "should provide less of a drag on GDP in the second quarter than previously anticipated".

The Canadian dollar held onto earlier gains, trading at C$1.2504 to the U.S. dollar, or 80.0 U.S. cents. ($1=1.2504 Canadian dollars)

(Reporting by David Ljunggren; editing by Jason Neely, Kevin Liffey and Jonathan Oatis) ((david.ljunggren@tr.com; +1 647 480 7891;))