BEIJING—China’s trade surplus with the U.S. hit another record monthly high in August as the world’s second-largest economy faced the threat of more tariffs from the Trump administration.

The trade gap between the two countries widened to $31.05 billion last month from $28.09 billion in July, while China’s total trade surplus narrowed, data from the General Administration of Customs showed Saturday.

The...