CHICAGO — Sandy (the hurricane), Bruce (the Jersey rocker), and Bill (the former president) certainly helped President Obama in the waning moments of the race. But in the end, it was the steadily rising economy that kept Obama afloat and prevented Mitt Romney from reaching the White House.

Americans were not as willing as Romney to blame the president for the nation’s problems, even after Romney spent two years relentlessly prosecuting Obama over the damage: high unemployment, tepid growth, ballooning deficits.

Much of America saw the country on the wrong track during Obama’s first term. At the same time, in the background, the much-reviled stimulus and auto bailouts did their job and helped the economy climb to its feet. Each month that brought stronger job numbers, every little uptick in consumer confidence, conspired to undermine Romney’s narrative.

At the same time, in an extremely tight vote that highlighted the nation’s deep divisions, Obama retained his base coalition of liberals, women, and African-Americans. The president enjoyed a huge advantage among Latinos, the nation’s fastest-growing electorate, after Romney tacked far to the right with a get-tough immigration stance during the GOP primary and struggled to return to the political center.

Obama’s relentless attack on Romney’s Bain Capital years helped persuade sufficient numbers of independents and swing voters that Romney was an unacceptable alternative, even if they were unhappy with the status quo.

Ultimately, for a guy who loves to immerse himself in data, Romney just couldn’t make the math work.

Added to the slowly improving economic indicators, the former Massachusetts governor proved incapable of cracking Obama’s stubborn lead. Despite Romney’s frequent indictments of Obama’s stewardship, the president’s job approval ratings climbed to around 50 percent in September and October, according to the Gallup daily tracking poll.

Even when Romney broke from his conservative course and delivered a stellar early October debate performance against the incumbent — suddenly presenting himself as a moderate with heart who was prepared to bridge partisan divides — it still was not quite enough.

Yes, Washington was gridlocked, but voters knew Republicans in Congress bore much of the responsibility.

Yes, the economy struggled and unemployment did not dip below 8 percent until the end of Obama’s first term. That was tempered by voters’ understanding that Obama assumed office in the midst of the worst economic calamity since 1929. Nationally, according to exit polls, about 40 percent of voters blamed Obama for the nation’s economic condition.

“The public to some degree discounted the poor performance, because of the bad hand Obama was dealt when he took over the presidency,’’ said John Geer, political science professor at Vanderbilt University.

This was not the inspirational victory of 2008. Obama hosted his Chicago celebration Tuesday night inside a hulking convention center on the shores of Lake Michigan — with admittance for ticket holders only — not in Grant Park where 240,000 giddy supporters showed up in 2008 to celebrate the election of the first African-American president.

Unlike that race, this campaign was a grind.

“Tonight, in this election, you, the American people, reminded us that while our road has been hard, while our journey has been long, we have picked ourselves up. We have fought ourselves back,” Obama said in his victory speech. “And we know in our hearts that for the United States of America, the best is yet to come.”

Obama’s team ultimately beat Romney on his own analytical terrain, by crunching numbers and studying precisely how to motivate their core voters while also snatching just enough of the undecided voters on the margins of polling data.

Then they deployed a broad and penetrating ground organization that scrubbed key neighborhoods in key counties in such key states as Ohio, making sure they contacted all of the households that were likely to support Obama.

“That’s the campaign we prepared for,’’ Obama adviser David Plouffe said on MSNBC Tuesday morning as the Obama troops fanned out across Ohio in a carefully choreographed canvass.

The Obama team also adopted wholesale the strategy the late Massachusetts Senator Edward M. Kennedy used to defeat Romney in the former businessman’s first foray into politics in 1994. They dug into his tenure as chief executive of Bain Capital and hammered Romney for shuttering factories and laying off workers. They painted Romney as an unrepentant capitalist with little concern for — or understanding of — how the rest of America lives.

It was, to a degree, a caricature, but Romney did himself no favors during the presidential campaign by repeatedly showing insensitivity toward those in other income brackets.

From the Republican primary race through the closing months of the general election, he often found himself explaining an impolitic remark.

The most damaging, perhaps, was caught on videotape at a private fund-raiser in May, when Romney asserted that nearly half of Americans saw themselves as “victims” and refused to take responsibility for their own lives.

The self-inflicted damage eroded the advantage Romney hoped to have against a president who had never worked in business. It became more difficult for Romney to argue that his long business career gave him insight into how the economy works, how to create jobs, and how to put the United States on the move again.

“I so wish that I had been able to fulfill your hopes to lead the country in a different direction,” Romney said through a forced smile in his concession speech. “But the nation chose another leader.”

There were other factors that didn’t fit neatly on a spreadsheet. The president remained well-liked by voters — much more so than Romney. He proved with Tuesday’s election that he had retained their trust, respect, and admiration, and that they were willing to give him four more years to fulfill the hopes and changes he outlined in 2008.

Next up for Obama is proving to those voters that he can achieve results. That remains an exceedingly difficult task in a deeply divided capital, with Republicans retaining control of the House on Tuesday and Democrats staying in charge in the Senate. Latinos who voted for Obama in large numbers Tuesday will demand that he seriously pursue immigration reform. Hurricane Sandy’s devastating effects in New York and New Jersey have renewed calls to address climate change.

Most immediately, the president and Congress will have to deal with the looming “fiscal cliff’’ — a set of automatic budget cuts that were put in place by Washington leaders to extract themselves from the 2011 debt-ceiling standoff, combined with the expiration of the George W. Bush-era tax cuts.

Economists warn that the nation will slide into another recession if the president and Congress do not come up with a plan to avoid the sudden shock to the economy that would result.

How these fiscal talks proceed will depend on how much political capital Obama is perceived to have gained in the election. He was narrowly winning the popular vote as the ballots were tallied into Wednesday. If Republicans see political danger in continuing to dig in their heels, will they be more willing to negotiate a tax overhaul that includes higher taxes for the wealthy?

Obama pounded Romney during the campaign for proposing a tax plan that did not add up. But Obama himself has avoided specifics that might prove politically inconvenient. He has issued broad statements about the need for responsible deficit reduction, but he has not said how he would reduce the expanding costs of Medicare and Social Security.

Last month as he fought off Romney’s surge in the polls, the president issued a 20-page blueprint for a second term — which he called a “New American Patriotism.’’ It is mostly a repackaged list of initiatives that never gained traction in Congress, combined with some of the broad goals he issued in his speech at the Democratic National Convention.

The section on protecting retirement programs for the elderly makes no mention of how to control costs.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.

Thanks & Welcome to Globe.com

You now have unlimited access for the next two weeks.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.