He had us worried. After the first TV debate, it looked like he had blown it. But in the end, Barack Obama won another four-year term in the White House by a surprisingly large margin.
The campaign had been bitter, with both sides engaging in negative advertising in swing states. Eve-of-voting-day polls showed that Obama and his Republican rival Mitt Romney were neck-and-neck on 49pc each.
The dynamics of US politics mean that presidential elections hinge on a few swing states. Most of the 50 states are unswervingly blue (Democrat) or red (Republican).
But a few – Ohio, Virginia and Iowa key among them – are up for grabs. Voters on November 6 delivered these states to Obama, albeit by small margins.
And there was last-minute drama in Florida once again, where voting queues were long and counting slow. Eventually, four days after election day, the Sunshine State finished its count and the state also went to Obama.
The see-saw campaign saw Obama lead in early polling, but the first TV debate changed that. Romney performed well, while the president appeared deflated and seemed to signal that Romney's arguments were so unreasonable that they did not require any refutation.
Obama performed better in the following two debates, and his vice-president Joe Biden was generally reckoned to have bested his opposite number, Paul Ryan.
The arrival of a tropical storm to the shores of New Jersey and New York took the focus off the election for a while, and may have handed Obama an advantage.
He appeared to be leading the rescue response and even garnered praise from New Jersey's Republican governor Chris Christie.
Romney's campaign was also severely gaffe-prone. His prediction on a visit to London that the city's Olympics would be a flop did him no favours, and the nomination convention in Denver was notable for the surreal sight of Clint Eastwood speaking to an empty chair representing the president.
Then a video of Romney addressing a fundraising gathering showed him dismissing 47pc of the population as welfare spongers who would never vote for him.
Obama didn't have it all his own way by any means. Unemployment remained high and he was accused of bungling the response to an attack on the US embassy in Benghazi.
The president could, however, claim credit for the fact that Osama Bin Laden was killed on his watch, for the bailout of the auto industry and for a generally surefooted handling of the economic crisis.
Obama's victory was dismissed by some commentators as not representing a real mandate, and by others as a decisive moment in American politics.