China says President Donald Trump's threat to cut off trade with countries that deal with North Korea is unacceptable and unfair.

Trump said on Twitter on Sunday the United States is considering halting trade with "any country doing business with North Korea." His remarks came after North Korea detonated a thermonuclear device in its sixth and most powerful nuclear test.

Geng Shuang, a Chinese Foreign Ministry spokesman, told reporters at a briefing in Beijing on Monday that China regarded as "unacceptable a situation in which on the one hand we work to resolve this issue peacefully but on the other hand our own interests are subject to sanctions and jeopardized."

Geng said: "This is neither objective nor fair."

China is the North's closest ally and commercial partner.