President Trump and Chinese Vice Premier Liu He signed a long-awaited "Phase One" trade deal in the White House's East Room Wednesday, but not before the president riffed extensively on stage about seemingly unrelated topics.

The president announced tariffs on Chinese goods will remain until a "Phase Two" agreement, which could be far away, amid a nearly two-year-long trade war that has hurt U.S. farmers and created a drag on global economic growth.

"We're leaving tariffs on which, people were shocked, but it's great," the president said. "But I will agree to take those tariffs off if we are able to do Phase Two. In other words, we're negotiating with the tariffs."

Get Breaking News Delivered to Your Inbox

It was only after the president name-checked what seemed to be roughly half the audience, decried the impeachment "hoax," joked about fired former FBI Director James Comey and floated the possibility of fireworks over Mount Rushmore that he reached the substance of the long-awaited agreement.

The teleprompter in the East Room remained on the same line for long moments, as the Chinese delegation looked on and occasionally clapped politely. The Chinese eventually had a chance to read a letter from Chinese President Xi Jinping.

"With this signing, we mark more than just an agreement, we mark a sea change in international trade," Mr. Trump said.

The agreement addresses intellectual property protection and enforcement, ending forced technology transfer, the expansion of American agricultural purchases, ending currency manipulation and rebalancing the U.S.-China trade relationship. The deal extensively discusses intellectual property protections, a key area U.S. negotiators long insisted must be a part of any agreement.

"The United States recognizes the importance of intellectual property protection," the agreement says. "China recognizes the importance of establishing and implementing a comprehensive legal system of intellectual property protection and enforcement as it transforms from a major intellectual property consumer to a major intellectual property producer. China believes that enhancing intellectual property protection and enforcement is in the interest of building an innovative country, growing innovation-driven enterprises, and promoting high quality economic growth."

The agreement also details U.S.-China cooperation on agricultural products, going into detail on dairy products, infant formula, beef and other meat. The agreement mentions soybeans, although it doesn't elaborate much on that product. The levies that would have hit American consumers hard, the price hikes on goods including mobile phones and computer monitors, have been put off for now under the deal.

As part of the agreement, the Chinese will also be buying up to $200 billion in U.S. goods, including agricultural products like soybeans and pork, offering some relief to U.S. farmers. Before the signing ceremony, National Economic Council director Larry Kudlow offered more detail on China's purchase targets for each of the following sectors:

Agriculture: $40 to $50 billion

Manufacturing: $75 billion

Energy: $50 billion

Financial services: $40 billion

"Between the two great nations, nothing like this has ever happened before," Kudlow told CNBC Wednesday. "This is such an important deal."

The president's economic adviser also told reporters that there will be an "enforcement mechanism" if China does not meet the targets.

Kudlow said China will make changes to its criminal and civil procedures to enforce issues of intellectual property theft and forced technology transfer, which have been a key point of contention for the U.S.

Ben Tracy and Rachel Layne contributed to this report.