But by this week, things may have gone too far, with North Korea unleashing a tirade in which it deployed some of the most damning insults in its playbook, accusing China of “dancing to the tune of the U.S.” and “styling itself as a big power.”

Chinese observers of relations between the countries were left in disbelief about how rapidly those ties have deteriorated, particularly after Beijing decided to cut off coal imports that provide badly needed currency for the North’s economy.

“At first many people thought it was a fake commentary,” Cheng Xiaohe, associate professor of international studies at Renmin University, said of the tirade against China, published in the North’s state-run news media on Thursday. “It is a big surprise that North Korea has launched such a strong attack against China. I expected an angry reaction — but not this strong.”…

The burst of criticisms from Pyongyang — coupled with Beijing’s coal ban — suggested boiling tensions between China’s president, Xi Jinping, 63, who sees himself as a global leader, and Mr. Kim, 33, an eccentric dictator.

Mr. Xi is said to have low regard for Mr. Kim, who has not visited China and is not known to have been invited.