Nigella Lawson told a jury that "acts of intimate terrorism" by her "brutal" ex-husband, Charles Saatchi, drove her to cocaine and cannabis.
The television cook said she succumbed to snorting cocaine in 2010 when she felt "ashamed, isolated and in fear" and also admitted to smoking cannabis "with or in front of" her children.
On a day of drama at Isleworth Crown Court in west London, Miss Lawson said Mr Saatchi was trying to destroy her by making public her drug use after his "menaces" failed to force her to return to him.
Miss Lawson, 53, said she first used cocaine when her first husband, John Diamond, was fighting cancer before his death from the disease in 2001.
Her admission came during the fraud trial of two former aides, but she repeatedly told a jury that she felt she was the one on trial and the victim of a witch hunt.
She also gave her first account of the row in a restaurant that led to the end of her marriage to Mr Saatchi, saying he grabbed her by the throat in a fit of jealousy, telling her: "I'm the only person who should be giving you pleasure."
Miss Lawson stood with her arms folded and clashed repeatedly with defence lawyer Anthony Metzer, QC.
Mr Metzer asked her: "Are you or have you ever been a user of cocaine?"
She replied: "I have never been a drug addict, I have never been a habitual user. There were two times in my life when I used cocaine.
"One time was when my husband's cancer was terminal and he was introduced to it, thinking it would help, and I did on maybe six occasions join in with him.
"There was another time I took cocaine, in July of 2010. I was having a very, very difficult time.
"I felt subjected to acts of intimate terrorism by Mr Saatchi. I felt totally ashamed, isolated and in fear and just unhappy.
"A friend of mine offered me some cocaine and I took it. It completely spooked me ... I didn't have a drug problem, I had a life problem, and I needed to deal with it and went to a therapist."
She ridiculed the suggestion that she had used cocaine "daily" for 10 years, joking: "People who do that are a lot thinner than I am."
Asked if she had ever used cannabis, she said: "I have. I would say with some shame, but I have to be honest, I have smoked the odd joint, starting, I would say, in the last year of my marriage to Mr Saatchi.
"I found it made an intolerable situation tolerable. Since freeing myself from a brilliant but brutal man I am now totally cannabis, cocaine and illegal drug free."
Asked if she smoked the drug "with or in front of" the couple's children from previous relationships, she said: "I sometimes did, I'm afraid to say."
At the close of the day's proceedings, she was told that she would have to return for further cross-examination.
Speaking of the public row in Scott's restaurant in Mayfair in June, when Mr Saatchi was photographed grabbing Miss Lawson by the throat and tweaking her nose, she said: "He told everyone he was taking cocaine out of my nose in Scott's - that is a lie.
"I will tell you what happened. Someone walked by with a very sweet baby in a stroller and I said, 'I'm so looking forward to having grandchildren' and he grabbed me by the throat and said, 'I'm the only person you should be concerned with, I'm the only person who should be giving you pleasure."
She added: "Mr Saatchi accepted a police caution for assault, that tells you everything you need to know."
Miss Lawson said in October that she no longer wanted to give evidence for the prosecution, and was asked why.
She said: "My relations with Mr Saatchi were not good. He said to me that if I didn't go back to him and clear his name he would destroy me and he also started spreading false allegations of drug use ... I felt his way of getting this out was to use this case."
He "menaced" her in August with threats of drug allegations, which later appeared on an internet blog "dedicated to salvaging Mr Saatchi's reputation and savaging mine".
She said: "I felt that this would not become a fraud case, I would be put on trial and that's what has happened. I have been put on trial here, where I am bound to answer the allegations and it comes after a long summer of bullying and abuse ..."
Miss Lawson said Mr Saatchi had a "temper" and "did not like to take part in family life". It would "irritate" Mr Saatchi that she was financially independent, as "someone having money, it can be used to wield power" and he was "a very controlling person", she said.
Mr Metzer, representing Elisabetta Grillo - who, with her sister Francesca, has denied accusations of spending hundreds of thousands of pounds on credit cards loaned by Mr Saatchi and Miss Lawson - asked the television cook if her background conflicted with her ex-husband's as her lifestyle was more "liberal, bohemian and gregarious".
She replied: "I don't understand why my marriage is pertinent to you."
Throughout her evidence Miss Lawson, who said her marriage had been "doomed", referred to her ex-husband only as "Mr Saatchi" and glared at Mr Metzer when he once accidentally called her "Mrs Saatchi".
Mr Saatchi threatened to sue his ex-wife if she refused to give evidence in the case, because, said Miss Lawson, "part of this campaign is to ruin me in whatever way, and if that is financial as well so be it".
"I think it would be 'Get her, I don't care what it takes, I don't care what it costs, do whatever it takes'. He feels betrayed by me."
Miss Lawson said she had been "punished" by Mr Saatchi for going to a female friend's birthday party, adding: "There was emotional abuse and it was very wounding."
Putting on reading glasses to look at credit card statements, she confirmed that Elisabetta Grillo was given jewellery as gifts, while another aide put her 12,500 ($24,940) wedding reception at the Saatchi Gallery on Mr Saatchi's credit card at the couple's suggestion. But she had not authorised the sisters' "giddy" credit card spending of 685,000.