BEIJING—China’s trade surplus widened in October from the previous month, a reminder of trade imbalances as U.S. President Donald Trump kicks off his first presidential visit to Beijing.

While the trade surplus with the U.S. narrowed somewhat, to $26.62 billion from $28.08 billion in September, it was the fifth straight monthly surplus of more than $25 billion. Louis Kuijs, an economist at Oxford Economics, estimates that the two countries’ trade difference will rise to nearly $370 billion this year.

That would exceed the $347 billion deficit with China hit in 2016, according to U.S. figures, by far the largest shortfall among the U.S.’s trading partners and adding to trade tensions.

Mr. Trump, who will be in Beijing until Friday, has long criticized China for unfair trade practices. He is seeking a narrower trade deficit with China and other trading partners, including Japan. A number of company executives are accompanying Mr. Trump to China.

China’s overall trade surplus climbed to $38.2 billion from September’s $28.5 billion, according to data released Wednesday by the General Administration of Customs. Economists were expecting a $40 billion surplus for October.