By Jeff Mason

WASHINGTON (Reuters) - He listed familiar grievances, praised and criticized his guests, and seemed to blow off some steam.

U.S. President Donald Trump signed a trade deal with China on Wednesday at a White House event that was part formal ceremony and part political theater.

Trump's trade war with China has been a centerpiece of much of his presidency, and the ceremony to seal a "Phase 1" deal - held at the White House rather than a more neutral location for the two sides - was a victory lap of sorts.

The Republican president relished the moment and the stage but also used it to rail against impeachment, banter with visiting chief executives, and lambaste China for past sins even as its representatives stood stoically nearby.

A former reality television star, Trump is known for stage managing his events closely, and this one was no exception.

The president chose to sign the agreement himself, despite the fact that his counterpart President Xi Jinping sent a lower level official to represent the Chinese side.

The ceremony started with requisite pomp in the formal East Room, packed with guests and journalists from both countries, as the president paraded down a central aisle with Chinese Vice Premier Liu He while a military band played "Hail to the Chief."

Trump then began his remarks from a podium on the stage, reading from a Teleprompter.

That did not last long.

While the vice premier and three other Chinese officials stood to his right, Trump strayed from his remarks with criticism of the "hoax" that he calls impeachment and of the way in which U.S.-China trade was handled in the past.

"Since China joined the World Trade Organization two decades ago, we have racked up nearly $5 trillion - the Vice Premier, I hope he's not listening to this - in trade deficits, lost millions and millions of manufacturing jobs, and saw tens of thousands of factories close," Trump said.

The president added later: "They were not doing things that they were supposed to be. And that’s okay. Because now they will."

Trump also introduced hordes of guests who were not on the stage, commenting on everything from Boeing's troubles with its 737 MAX jet to his seeming regret over choosing Jerome Powell to be chairman of the Federal Reserve.

To Kevin Warsh, who Trump also considered for the position, the president said: "Why weren’t you more forceful when you wanted that job? Why weren’t you more forceful, Kevin? ... I would have been very happy with you."

To David Calhoun, the new chief executive of Boeing, Trump alluded, from the stage, to the crisis over the 737 MAX, which has been grounded since March.

"Stand up, David. See, he didn’t want to stand. Let me tell you: It’s not your fault. You just got there. You’ll straighten it out quickly, please," Trump said.

"We will," Calhoun replied from where he sat in the audience.

Some 35 minutes into the ceremony, Trump returned to the Teleprompter. Roughly 50 minutes in, he passed the microphone to U.S. Trade Representative Robert Lighthizer, who spoke briefly.

When it came time to sign, Trump sat down at a table on the stage and motioned spontaneously for U.S. lawmakers in the room to come stand behind him. That prompted guests on the Chinese side, which cares deeply about protocol, to come up as well, crowding the stage and blocking the view.

Once the ceremony was officially over, the music started up again. This time the song was: "What a Wonderful World."

(Reporting by Jeff Mason; Editing by Sonya Hepinstall)