Democratpoured millions of dollars into Florida over the summer but couldn't close in on comfortable lead. The Republican didn't flinch, confident the state was trending toward the GOP eight years after it gave George W. Bush the White House.
Then the mortgage crisis hit, jolting the high-foreclosure state and its presidential politics.
Now, the coveted state with 27 electoral votes is a tossup.
And, Republicans and Democrats alike say getting voters to the polls is the key.
"We're feeling urgent," said Obama deputy campaign manager Steve Hildebrand, who is now working out of Miami, signaling just how hard the campaign is competing. "We've got a lot to prove."
Republicans concede Obama has more money, staffers and offices in Florida but say the GOP has a better battle-tested operation with experienced staffers and volunteers.
"They've been in tough elections, close elections every two years for 10 years," said Mike DuHaime, McCain's political director. He said he's also heartened by the fact that Republicans have requested about 200,000 more absentee ballots than Democrats, who lead in registrations.
With the Nov. 4 election approaching, most polls show the race is very close.
Florida is critical to McCain's strategy of winning the requisite 270 Electoral College votes; Bush won twice, though in a disputed election the first time, and McCain is trying hard to defend Florida against Obama's onslaught lest he has to make up the 27 electoral votes he would lose. Obama could lose Florida and still be in a stronger position to cobble together wins in enough states for victory.
McCain campaigns in Florida on Friday. Obama joins former rival Sen. Hillary Rodham Clinton in the state on Monday.
They're campaigning in a state that is far from homogeneous.
Urban South Florida favors Democrats, largely rural north Florida identifies more with the South and votes conservative and the Interstate 4 corridor that splits the state from Tampa through Orlando to Daytona Beach is where both parties fight aggressively for independents and crossover voters.
Florida has a high population of transplants from the Northeast and Midwest; immigrants from Latin America, Haiti and elsewhere and a large number of Jewish voters. Retirees flock here and the state has a lot of veterans, many of whom stay after serving in the state.
All that means Florida is a difficult place to campaign. And it's also expensive, with its many media markets.
With about three weeks to go in the campaign, Obama had spent more than $21 million on advertising in Florida for the general election, compared with about $5 million by McCain, according to TNS Media Intelligence/Campaign Media Analysis Group, a firm that tracks political advertising.
Obama went up on the air weeks before McCain with advertising and built a grass-roots team that overshadows John Kerry's efforts four years ago and Al Gore's in 2000. The Democrat entered the general election at somewhat of a disadvantage, having refrained from campaigning in the state during the Democratic primary because of a party dispute over the primary's timing and the counting of the state's convention delegates.
McCain, conversely, waited until the fall to put the bulk of his resources into Florida, given polls showing him leading in a state that has become difficult for Democrats to win. It has only supported one Democratic presidential candidate since backing Jimmy Carter in 1976 Bill Clinton in 1996.
"There was some assumption that Florida was going to be fairly solid on their side and maybe they didn't anticipate this being as close," Republican Party of Florida Chairman Jim Greer said of McCain's advisers.
Unlike Obama and the Democratic primary, McCain had lavished Florida with attention during the GOP primary and his win here over Mitt Romney ensured he got the nomination. The Republican also has personal ties to the state from his Navy days and is close to the popular Gov. Charlie Crist. He's also well-liked in the influential Cuban-American community in south Florida.
"Even though Republicans are in the White House and a Republican is in the governor's mansion, this is definitely different than it was four years ago," said Brett Doster, Bush's Florida political director in 2004 and during the 2000 election that led to a recount and ended with the Supreme Court ruling in the GOP's favor.
In 2004, the state's economy was still soaring. Unemployment was low, the housing market hot. Jeb Bush, the president's brother, was the state's popular governor and Republicans were winning the argument with Florida voters on national security and Iraq.
This fall, the economy dominates the election. Florida's unemployment is higher than the national average and the highest it's been in more than 13 years. The state has one of the worst foreclosure rates in the nation.
Among the unknowns that will shape the race in the final weeks:
Can Obama win over Jewish voters?
Will seniors reject the idea of another Republican in the White House as the Wall Street chaos batters their retirement accounts?
How will non-Cuban Hispanics vote?
Will Obama's efforts to increase registration and turnout work?
Obama is counting on people like Curtiss Lowe of Bonita Springs, who recently attended an event by Obama's running mate, Joe Biden, in Fort Myers.
Lowe registered as a Democrat for the first time in this election and has been volunteering for Obama's campaign every day of the week for a month.
"Everything is about the economy to me," said Lowe, who just started a business as a specialist who fits hearing aids. "What's going to happen to my 401(k)? The majority of my patients are elderly people, 76 years old, and they are worried about their financial future, too."
Lifelong Democrat Ada Dunwody of Fort Myers is among another group of voters Obama hopes will lift him to victory; Bush critics.
"I've felt the pain of this administration, I felt it deep. We've gone down in business 25 percent," said Dunwody, a partner in an electrical contracting company. "I'm afraid it's going to get worse if we have more McCain."
Republicans Angela and Spencer Rogers, a young married couple from Land of Lakes, Fla., whose baby is due in January, say just the opposite and they are backing McCain.
"The world is uncertain. The economy is uncertain," said Spencer Rogers, an Army veteran who did two tours in Iraq and just started his own business to help units get ready for combat. "I know Barack Obama is going to be taxing me a lot if he gets elected. So times are hard and I really want to make sure I can provide for my newborn and for my family."
Angela Rogers added: "I just don't want to take a risk on Obama. We just can't take a risk right now. These are dangerous times for our economy, for the world abroad, it's a dangerous time."