NEW YORK — Porn star Stormy Daniels described her 2006 encounter with Donald Trump in unflattering terms at his criminal trial on Tuesday, testifying she tried not to think about the sex while it took place and feared it would become public.

For several hours Daniels, 45, offered riveting details on the witness stand about her encounter with Mr. Trump, 77, and the hush money deal she reached to stay quiet about it ahead of the 2016 election when he won the White House.

She told jurors that her life descended into “chaos” after the arrangement was made public in 2018, saying she was ostracized and harassed at her home.

“Who do you understand Mr. Trump to be referring to as horseface and sleazebag in this post?” prosecutor Susan Hoffinger asked her as she displayed a social media post by Mr. Trump.

“Me,” Daniels replied.

Ms. Daniels’ testimony provided fodder for Mr. Trump’s lawyers to seek a mistrial, arguing that details, such as her statement that Mr. Trump did not wear a condom, served no purpose other than to inflame the jury. Justice Juan Merchan denied that request but agreed that some of her testimony ran too far afield.

Mr. Trump’s lawyers attacked her credibility and grilled her about inconsistent statements she has made over the years about her time with Mr. Trump.

Ms. Daniels also conceded that she “hates” Trump and wanted to make money off her story. Her explanation for why she went public after seven years of silence and denials also was unclear.

Mr. Trump, the Republican candidate for president again this year, did not react as he watched from the defense table. He has pleaded not guilty to charges of falsifying business records to cover up a $130,000 hush money payment to Ms. Daniels and denies having sex with Ms. Daniels.

His legal team has suggested that Ms. Daniels was angling for a spot on The Apprentice, a popular reality TV show then hosted by Mr. Trump, a New York real estate mogul.

Ms. Daniels confirmed that she hoped he would cast her on the show following their encounter.

“This was a very big day, a very revealing day. As you see their case is totally falling apart,” Mr. Trump told reporters outside the courtroom at the end of the day. The trial resumes on Thursday when Ms. Daniels will again take the stand.

Ms. Daniels said Mr. Trump made sexual advances after inviting her to his hotel suite at a celebrity golf tournament in Lake Tahoe, Nevada. Ms. Daniels testified she grew up as the daughter of a low-income single mother.

She said Mr. Trump told her: “This is the only way you’re getting out of the trailer park.”

Ms. Daniels said she “blacked out” despite consuming no drugs or alcohol after Mr. Trump prevented her from leaving the room by blocking the door. She said she woke up on the bed with her clothes off.

“I was trying to think about anything other than what was happening there,” Ms. Daniels testified.

Ms. Daniels, whose real name is Stephanie Clifford, said she did not tell Mr. Trump to stop. “I didn’t say anything at all,” she said. She said she left the hotel room quickly afterward.

The Republican politician, who served as president from 2017 to 2021, says the trial is an attempt to hobble his attempt to win back the White House from Democratic President Joseph R. Biden in a Nov. 5 election.

Wearing a black outfit and black glasses, Ms. Daniels testified that she worked in strip clubs and pornography after a childhood in which her mother was often gone for days at a time.

She said Mr. Trump greeted her at his hotel suite wearing satin pajamas. She said she grew annoyed by Mr. Trump’s frequent interruptions and asked him: “Are you always this arrogant and pompous?”

Mr. Trump then dared Ms. Daniels to spank him with a magazine and she obliged. “He was much more polite after that,” she said. “That’s bullshit,” Mr. Trump appeared to say on Tuesday as he watched from the defendant’s table.

The alleged encounter took place while Mr. Trump was married to his current wife Melania.

Ms. Daniels said she confided in only a few people about the sex. She said she saw Mr. Trump at public events on several occasions in the years that followed, but then fell out of touch with him after he did not put her on The Apprentice.

Ms. Daniels said she was determined to keep the incident private after being threatened in a parking lot in 2011 but changed her mind during Mr. Trump’s 2016 presidential bid, when he faced multiple accusations of sexual misbehavior.

“My motivation wasn’t money, it was to get the story out,” she said.

Daniels ultimately negotiated a $130,000 payment with Mr. Trump’s lawyer Michael Cohen, and prosecutors say Mr. Trump falsified business records to obscure the fact that he reimbursed Mr. Cohen for the payment.

She testified she was eager to collect before the 2016 election because she was worried he would not pay her if he won.

The case is widely seen as less consequential than three other criminal prosecutions Mr. Trump faces, but it is the only one certain to go to trial before the election.

The other cases charge Mr. Trump with trying to overturn his 2020 presidential defeat and mishandling classified documents after leaving office. Mr. Trump has pleaded not guilty to all three.

In Florida, where Mr. Trump is accused of illegally keeping classified documents, a judge decided to indefinitely postpone the trial on Tuesday, greatly reducing the odds he will face a jury in the two federal cases before the election. — Reuters