Lewis Hamilton defied the heavy favouritism bestowed on Rory McIlroy, as the Formula One world champion won the BBC’s Sports Personality of the Year award in Glasgow on Sunday evening.

With minutes to go before the winner was announced, McIlroy was heavily favoured to become the first golfer in 25 years to lift the trophy. Instead, Hamilton prevailed with 209, 920 telephone votes from 620,932 cast, with the golfer edged into second place on 123, 745. Athlete Jo Pavey, a source of inspiration to many on account of distance running heroics, took third on 99,931 votes.

Hamilton, who later admitted he would have voted for McIlroy were he watching at home, seemed slightly shocked when addressing the 12,000 crowd at the SSE Hydro arena. “I really wasn’t expecting that,” he said, “especially as I was watching all of the videos during the awards. We are really talking about some of the great sportspeople of our time.

“I am really, really taken aback. I am overwhelmed and feel so honoured. I have an amazing following but you never know how well you are appreciated throughout the whole of the UK. I would have been proud just to be amongst these people, who have done such amazing things.

“When I was growing up in Stevenage, of course I wanted to be a racing driver and be the best in the world but I didn’t ever contemplate all the people who would support or follow me. I just wanted to be the best.”

Damon Hill, in 1996, was the last Formula One driver to win the BBC title.

McIlroy was gracious in defeat, despite being entitled to feel disappointed. This was a year in which the 25-year-old claimed two major championships and surged back to the top of the world rankings.

“Lewis has had a fantastic year so I have no complaints,” said the Northern Irishman. “This was his second world championship and he dominated the F1 season.

“I had a lot of support out there. To finish second is still a great achievement. Hopefully if I can achieve just as much next year, if not more, I can go one better.”

McIlroy’s fellow golfer Ian Poulter took to Twitter to suggest it was ridiculous that McIlroy was upstaged by Hamilton.

Golf was represented among the winners, though. Paul McGinley, who masterminded Europe’s comprehensive success over the United States at the Ryder Cup, was presented with the coach of the year award. The Irishman paid special tribute “first and foremost to the people of Scotland” for their backing of the European cause at Gleneagles.

McGinley added: “It was very much a team effort, I had a lot of people in place to help me. It has been a wonderful time in my life. People are very gracious, they say lovely things. What has pleased me most is seeing the pride they have.”

The England women’s rugby union team, who claimed the World Cup with a victory over Canada in Paris, was named as the team of the year. Their captain, Katy McLean, hailed this recognition as “a massive turning point for women’s sport”.

Former cyclist Sir Chris Hoy was presented with a lifetime achievement award by Prince Harry and footballer Cristiano Ronaldo appeared via recorded video message after being named as the overseas sports personality of the year.

“This really is incredibly special to me,” said Hoy. “I thought my days of getting emotional were over when I retired but it’s impossible not to be when you hear such special words. I feel like the luckiest guy around, I can’t believe I was able to do what I love for so many years.

“I looked at some of the names who have won this trophy before me, Seve Ballesteros, Pele, Martina Navratilova. To have my name beside them is quite surreal.”