WASHINGTON—U.S. exports and imports both rose for a fifth straight month in October, reflecting a continued recovery in global commerce driven by a strong economic rebound in China.

Exports from the U.S. rose 2.2% to $182.0 billion from the previous month, while imports rose 2.1% to $245.1 billion, the Commerce Department said Friday. The trade deficit widened to $63.1 billion from $62.1 billion. The figures were adjusted for seasonal variations.

U.S. goods exports to China rose to a record $14.72 billion in October from $11.54 billion in September and surpassing the previous high of $13.63 billion set in December 2017. Imports from China rose to $44.83 billion from $41.21 billion, hitting the highest level since December 2018.

Global trade has recovered more quickly than economists expected since widespread lockdowns were imposed in March and April, but activity remains well below pre-pandemic levels. Economists say the outlook for trade remains uncertain amid the acceleration in the spread of the virus globally, but particularly in the U.S.

“Virus transmissions remain elevated and widening restrictions on activity, at home and abroad, have the potential to disrupt supply chains and weigh on demand,” Rubeela Farooqi, chief U.S. economist for High Frequency Economics said in a research note.