A member of pop group the Spice Girls, she says she took the Class A drug up to six times a day to help her cope on the hit ITV show.
In extracts of her new autobiography published in The Sun on Sunday, she wrote: "Then I would pray, 'God, I'm sorry for taking cocaine but, please God, help me get through this day'.
"It numbed my pain. It lifted me up enough to be ready to fire on all cylinders and forget about everything but the show.
"I told myself God would understand and forgive me because he could see through all the glitter and the cr*p.
"He could see me. The mess. And the cocaine could help that mess. Just for now."
Yipppeeeee The audiobook of my memoir BRUTALLY HONEST comes out on Nov 27. It's narrated by me, my daughter Phoenix, my mum Andrea and the amazing Zaraah Abrahams. Pre-order today from... https://t.co/y2XzPLZ0l3
— Melanie Brown (@OfficialMelB) November 13, 2018
Mel B says the substance never affected her performance on The X Factor, nor did she ever take it during shows.
In her book, Brutally Honest, the 43-year-old mother said she used cocaine as a "quick fix" during her turbulent marriage to Stephen Belafonte. They officially divorced in August this year.
Mel B, whose real name is Melanie Brown, also wrote about an unsuccessful bid to take her own life in December 2014.
Earlier this month, the Spice Girls (pictured) announced a UK stadium tour without Victoria Beckham.
If you have been affected by the issues raised in this story, you can call the Premier Lifeline - a confidential and free Christian telephone helpline - on 0300 111 0101.
Stay up to date with the latest news stories from a Christian perspective. Sign up to our daily newsletter and receive more stories like this straight to your inbox every morning.