The 36-year-old former prison officer sold twice as many copies of her single, Skyscraper, than US star Pharrell Williams in second.
Bailey, 36, who was crowned the winner of the singing contest last week, is splitting all proceeds between Great Ormond Street Hospital Children's Charity and Together For Short Lives, a charity which helps children with life-threatening conditions.
Chancellor George Osborne has agreed to waive VAT on the release.
Bailey told OfficialCharts.com: "Being Number 1 is absolutely amazing.
"It really is the icing on the cake and it means Great Ormond Street Children's Charity and Together For Short Lives will benefit from the single, which makes it extra special."
Bailey sold 149,000 copies of Skyscraper, outstripping Happy by Williams by more than two copies to one to become one of the fastest selling singles of the year.
One More Sleep by the 2006 X Factor winner Leona Lewis came in third spot.
Robbie Williams held on to top spot in the album chart with Swings Both Ways.
The Take That star's record was neck-and-neck midweek with One Direction's Midnight Memories and Gary Barlow's Since I Saw You Last in a tight race.
But Williams beat off One Direction by fewer than 200 copies after both acts sold more than 126,000.
Won by: Steve Brookstein Mentor: Simon Cowell Runner up: G4
Won by: Shayne Ward Mentor: Louis Walsh Runner up: Andy Abraham
Won by: Leona Lewis Mentor: Simon Cowell Runner up: Ray Quinn
Won by: Leon Jackson Mentor: Dannii Minogue Runner up: Rhydian Roberts
Won by: Alexandra Burke Mentor: Cheryl Cole Runner up: JLS
Won by: Joe McElderry Mentor: Cheryl Cole Runner up: Olly Murs
Won by: Matt Cardle Mentor: Dannii Minogue Runner up: Rebecca Ferguson
Won by: Little Mix Mentor: Tulisa Runner up: Marcus Collins
Won by: James Arthur Mentor: Nicole Scherzinger Runner up: Jahmene Douglas
Won by: Sam Bailey Mentor: Sharon Osbourne Runner up: Nicholas McDonald