Tuesday’s session of Donald J. Trump’s criminal trial began with a heated clash between Justice Juan M. Merchan and Mr. Trump’s lead lawyer over a gag order. It ended with an insider’s look into a tabloid newspaper practice known as “catch and kill.”

Prosecutors said that Mr. Trump had “willfully and blatantly” violated a gag order barring him from attacking jurors and witnesses, among others. They said he had done so in comments outside the courtroom and online and should be found in contempt of court.

Mr. Trump’s top lawyer said in response that Mr. Trump was simply defending himself from political attacks. Justice Merchan did not rule, but he scolded the lawyer, Todd Blanche, saying, “you’re losing all credibility with the court.”

A former ally of Mr. Trump, David Pecker, the ex-publisher of The National Enquirer, later testified to buying and burying unflattering stories about Mr. Trump during his 2016 run for president, an arrangement he called “highly, highly confidential.”

Mr. Trump, 77, faces 34 felony counts of falsifying business records to hide a payment to a porn star, Stormy Daniels, made to cover up a sex scandal that threatened to derail his campaign. Ms. Daniels, who may testify, has said that she and Mr. Trump had a brief sexual encounter in 2006, something the former president denies.

Mr. Trump has pleaded not guilty. If convicted, the former president — and presumptive Republican nominee — could face probation or up to four years in prison.