In recent years, it had become as predictable as elections in North Korea – singer wins X Factor, singer's debut single goes to No 1. So when Joe McElderry won the TV talent contest, he was no doubt confident he would celebrate Christmas at the top of the charts.

Alas for the 18-year-old from South Shields, it wasn't to be: a song almost his own age denied him the top spot after a successful online campaign.

Killing In The Name, an expletive-heavy rock song first released in 1992 by the Californian rock band Rage Against the Machine, won the battle for Christmas top spot on the basis of downloads only. It sold about 500,000 copies last week, about 50,000 more than The Climb, McElderry's earnest ballad.

Depending on your view, the Rage victory was either a delicious dismantling of the X Factor Christmas No 1 juggernaut or a cynical assault on the festive charts. There was, though, some indignation when it emerged both records had links to Simon Cowell, the entertainment industry's favourite pantomime baddy. With the Rage track having been released by Sony, and McElderry's by Cowell's Syco, a Sony subsidiary, some claimed the high-waisted X Factor judge would emerge triumphant whichever act won the chart battle.

Rock fan's campaign

But arguably the real victor here was a rock fan from Essex who started a Facebook group a month ago with the (then) pie-in-the-sky idea of usurping the X Factor winner from the no 1 slot.

Jon Morter, 35, a part-time rock DJ and logistics expert from South Woodham Ferrers, near Chelmsford, decided it would be a bit of a giggle to start a campaign to encourage people to buy a record with pretty much the opposite vibe to the X Factor winner's ballad. While McElderry urges listeners to "keep the faith", the Rage track is best known for its now-ironic refrain: "Fuck you, I won't do what you tell me."

He had tried a similar wheeze last year, when he attempted to get Rick Astley's Never Gonna Give You Up to the top of the Christmas charts. Alexandra Burke, the 2008 X Factor winner, won that battle, but having succeeded in propelling Astley to "the lower echelons of the chart", Morter was emboldened to try again. This time, he was helped by the comedian Peter Serafinowicz, who on 15 December urged his 268,000-plus Twitter followers to join in, and it snowballed from there. By the time Paul McCartney and former X Factor winner Steve Brookstein had pledged their support, poor McElderry seemed doomed.

When the Guardian broke the news to Morter that he had won, he was initially lost for words. "Oh bloody hell," he said, as the consequences of what he had done became clear. Composing himself, he said: "I think it just shows that in this day and age, if you want to say something, then you can – with the help of the internet and social networking sites like Facebook and Twitter. If enough people are with you, you can beat the status quo."

But doesn't he feel guilty about denying McElderry his first No 1? "Umm. no," he said. "Not really. At the end of the day he has had a Christmas no 2 with his debut single, which is still a phenomenal achievement."

Gracious in defeat

Morter, a big Iron Maiden fan, said the choice of a relatively obscure Miley Cyrus cover for McElderry's single helped the Rage campaign: "If he had released Don't Stop Believing [the Journey song McElderry sang in an X Factor heat] we would have been dead and buried."McElderry took his defeat graciously, saying: "Fair play to the guys who have organised the Facebook campaign – it's been exciting to be part of a much-hyped battle and they definitely deserve congratulations. This time last year I never thought for one minute I'd win The X Factor, never mind having a single out. I'm just delighted to be in the charts."

Despite Cowell giving some pseudo-grumpy interviews, he phoned Morter on Saturday night to congratulate him on the campaign. "He commended us on how we had marketed the campaign, and said if we won, he would be the first to congratulate us," Morter said.

Rage Against the Machine have pledged to give all profits of the single to the homelessness charity Shelter, and will perform a free victory gig in the UK to thank those who bought their single.

McElderry is off on an Alpine skiing holiday to ponder his next move.