Still, there were detours along the way, most notably Obama's dismal performance in the first debate, which breathed new life into Republican challenger Mitt Romney's campaign. The deadly attack on a U.S. Consulate in Benghazi, Libya, thrust foreign policy into the spotlight and exposed Obama to a flurry of GOP criticism of his leadership. And Superstorm Sandy upended the campaign in its closing days, though the political impact appears to have been positive for Obama, who got a high-profile opportunity to show voters his presidential leadership
Even as national polls suggested an exceedingly close race, Obama's advisers insisted they had the edge in the nine competitive states. By Wednesday, Obama had won seven of them, with Florida still too close to call. Exit polls also backed up the Democratic team's assertions that the coalition of young people and minorities who supported Obama in 2008 would still vote in big numbers this time around.
Black voters made up 13 percent of the electorate, just as they did in 2008, and Hispanics increased from 9 percent to 10 percent. Obama won more than 70 percent of Hispanics and more than 90 percent of blacks, according to exit polls. He also maintained his advantage with women, defeating Romney by 11 points among female voters.
While the demographics looked the same, Obama aides knew from that start that this would have to be a different kind of campaign than his insurgent, optimistic race four years ago. The public's frustration with the sluggish economy and high unemployment made Obama vulnerable. And the deeply partisan bickering that consumed much of his presidency made it impossible to run again on a promise to change Washington or to claim that those efforts had succeeded in his first term.
The Chicago-based campaign quickly coalesced around a strategy to transform the race from a referendum on Obama's economic record into a choice between the president and Romney, the man aides always expected to win the Republican nomination.
Even before Romney officially became the nominee, Obama's team was savaging him on the airwaves. The campaign spent millions of dollars on television advertisements that sought to cut down Romney's business record, the central tenet of his campaign, and his character, casting the multimillionaire as a secretive protector of the rich.
Interviews with voters leaving polling places on Tuesday showed the president with a 10-point lead over Romney on the question of which candidate is more in touch with people like them. Of those holding that view, 91 percent voted for Obama.
The president, whose cool exterior belies a deeply competitive core, backed his team's decision to go negative early.
As the race pressed on, the economy's trajectory also started to help Obama.
Unemployment, which peaked at 10.1 percent during his term, had dropped to 7.9 percent by Election Day. By October, consumer confidence had reached its highest level since February 2008.
While Obama and Romney squabbled through the summer and into the fall, the Democratic team was mobilizing a field operation in competitive states that proved to be just as robust as its highly praised operation from 2008.
Obama's campaign never fully left places like Ohio and Iowa after the 2008 election. And while Romney battled through the GOP primary, the Democratic campaign was opening dozens, and in some cases hundreds, of field offices across the states.
The staffers and volunteers in those offices helped register 1.8 million new voters in the key battlegrounds, nearly double the number the campaign said it registered in 2008. Officials said volunteers made more than 125 million personal phone calls or door knocks with voters.
Obama's team also focused heavily on running up a lead in early voting and using the extended polling time to get supporters without a consistent voting record to the ballot box. Before Election Day, campaign officials said their early voting advantages meant Romney would have needed to exceed 50 percent or more of the remaining votes in Iowa, Colorado, Nevada and Ohio to pull off victories there. He lost all four states.
Throughout the campaign, Obama advisers prided themselves on not getting diverted by polls or the latest Twitter trend. After damaging video surfaced of Romney decrying 47 percent of Americans who believe they are victims, Obama advisers warned the race could still tighten. And when it did after Obama's woeful debate performance, they calmly insisted they had always planned for a close contest.
Obama was helped in the final stretch by two factors that Romney simply couldn't blunt.
One was Bill Clinton, the popular former Democratic president who became an exceptional surrogate, holding dozens of campaign appearances for Obama and vouching for his economic record.
The second was Sandy, the storm that struck the East Coast during the final full week of the campaign. Obama scrapped three days of campaigning and returned to Washington to manage the government's response.
It was an opportunity for Obama to project command and comfort in a crisis. His response won bipartisan praise, most notably from New Jersey's Republican Gov. Chris Christie, a vocal Romney supporter.
Forty-two percent of voters said Obama's response to Sandy was important in their vote for president. Most of those voters supported his re-election.
Associated Press writers Ben Feller in Washington and Jim Kuhnhenn in Chicago contributed to this report.