"Mexico and China compete. When Mexico wins, China loses. When China wins, Mexico loses," Guajardo said on " The Exchange ."

The U.S. and China have been engaged in an escalating trade war. However, it was Mexico in Trump's sights on Thursday night, when he blindsided the U.S.' southern neighbor with the announcement that his administration will impose a 5% duty on all Mexican imports starting June 10. The tariffs will gradually increase to 25% in October, the White House said.

There's no doubt that President Donald Trump 's surprise new tariffs on Mexico are good for China, Jorge Guajardo, former Mexican ambassador to China, told CNBC on Friday.

Chinese President Xi Jinping smiles during the awarding ceremony in the Xingua University on April 26, 2019 in Beijing, China.

Trump said he was imposing the tariffs to stop illegal immigrants from coming through Mexico into the U.S. The announcement came just as the approval process for the new trade agreement between the U.S., Mexico and Canada started to get underway.

That's led to concern about the impact of Trump's latest tariffs on trade talks with China.

"How can you trust Trump to honor a deal?" Chris Krueger, Washington strategist at Cowen, said in a note.

Trump's latest move also emboldens Chinese President Xi Jinping, who is the "biggest winner" here, Guajardo said.

Xi has been under pressure because some in his government were accusing him of misjudging the U.S. in trade negotiations, he explained.

Now, "he could have proof to go back to the people of China and say 'China did not make any concessions to the United States and got the same result as Mexico,'" Guajardo said.

"So, without a doubt, yesterday was a great day for China."

Earlier this month, Trump accused Xi of backing out of talks and raised tariffs to 25% from 10% on $200 billion in Chinese goods. China retaliated by boosting duties on $60 billion in U.S. goods.

Since then, the two countries have been lodging trade threats against each other. China has reportedly halted U.S. soy purchases and threatened to cut off its rare earth minerals supply to the U.S. Meanwhile, the U.S. has blacklisted Chinese telecom giant Huawei, making it nearly impossible for the company to service customers.

— CNBC's Yen Nee Lee and Yun Li contributed to this report.