WASHINGTON — In the Oval Office on Tuesday, as fears of a trade war with China roiled markets and panicked American farmers and lawmakers, Larry Kudlow, President Trump’s new top economic adviser, scored what passes for a major coup in a White House whipsawed by angry presidential tweets.

He helped get the president to say something nice on Twitter about President Xi Jinping of China.

“Very thankful for President Xi of China’s kind words on tariffs and automobile barriers,” Mr. Trump tweeted, referring to a trade speech that Mr. Xi had just delivered. “We will make great progress together!”

It was a sign of the early fingerprints of Mr. Kudlow, the Wall Street economist best known as a CNBC television personality who is now the director of the White House’s National Economic Council. Mr. Kudlow, barely two weeks into the job, casts himself as a “happy warrior” trying to give the best economic counsel he can to a president who has proved disinclined to follow advice.

“The way this has worked so far, we’ve been pretty close, but we have had differences,” Mr. Kudlow said of himself and the president during an interview in his West Wing office on Thursday. Asked what those were, he replied: “Oh, Lord…. I’m not sure I want you to know that.”