WASHINGTON (MarketWatch) — President Barack Obama managed to fight off a struggling economy to capture a second term as the nation’s chief executive Tuesday, vowing that “we’ve got more work to do” to cure the country’s fiscal ills.

It wasn’t the mandate he achieved four years ago, but Obama captured many of the same states he took when first elected in 2008, and was on the road to winning the popular vote — though that was in doubt at first. In defeating Republican challenger Mitt Romney, Obama won all the critical states where he held the slimmest of poll leads, including Ohio, Virginia, Colorado and Nevada.

Speaking to a large throng of supporters in Chicago early on Wednesday, Obama — his voice weathered by weeks of relentless campaigning — gave an impassioned speech in which he said, “The task of perfecting our union moves forward.”

“We have fought our way back. And we know, in our hearts, that for the United States of America, the best is yet to come,” Obama said.

Obama paid homage to Romney, congratulating him on a “spirited” race. It was a contest in which the two rivals fought bitterly, exchanging verbal broadsides in debates as well as tough rhetoric on the campaign trail.

“We may have battled fiercely but it’s only because we love this country so deeply,” Obama said.

Romney, meanwhile, stepped onstage in Boston early Wednesday morning to concede the race. The loss culminates six years that Romney, a former Massachusetts governor with roots as a manager in the business world, has vied for the presidency. His first attempt in 2008 failed when Sen. John McCain won the Republican nomination. He noted to supporters that he gave his all to this latest effort.

“Like so many of you, [running mate Rep.] Paul [Ryan] and I have left everything on the field,” he said.

While wishing Obama well, he noted the deep divisions within the nation’s political structure and pleaded with U.S. leaders to come together. Republicans were expected to retain control of the House while Democrats will stay in power in the Senate.

“We can’t risk partisan bickering and political posturing. Our leaders have to reach across the aisle,” Romney told supporters. He said he would “earnestly pray” for Obama’s success in guiding the nation over the next four years.

Obama’s first task will be to avoid a fiscal cliff that threatens to hurl the economy back into recession if Democrats and Republicans can’t work out an agreement on reducing the nation’s $16 trillion in debt.

Already, financial advisers were telling investors about the possible implications. BNP Paribas analysts said in a note to clients that the election’s thin margin will mean neither party can claim a mandate.

“Moreover, this election result reflects an electorate begging for compromise,” the brokerage’s note said. “Consequently, we think we will end up with a broader and more benign compromise on the fiscal cliff, potentially including a lifting of the debt ceiling before year-end.”

Obama will be swept into a second term despite an economy that crashed as he took office and has struggled ever since. Unemployment that topped out at 10% now stands at just under 8%. He is due for his second inauguration on Jan. 20.

Indeed, just a quarter of respondents to an exit poll conducted by the Associated Press on Tuesday say they’re better off than four years ago — but about half say that former President George W. Bush is more to blame for the weak economy than Obama.

U.S. President Barack Obama supporters cheer during his victory election night rally in Chicago, November 6, 2012. Reuters

The president had told supporters there still was work to be done on the economy, and he made sure the public was aware of his foreign policy achievements, particularly the killing of al Qaeda leader Osama bin Laden. What remains uncertain is whether Americans will fully embrace his health-care overhaul and plans to boost green energy development.

Obama will fall short of his 2008 electoral vote total of 365, as he captured 303 at last count with only Florida’s 29 electoral votes to be committed . Various tallies gave Obama a razor-thin but growing lead in the popular vote.

Along the way, Obama won a litany of key states. Along with Ohio, Virginia, Colorado and Nevada, he also took Pennsylvania — where Romney made a last-ditch effort to try and snatch the state from his hands — as well as Michigan, New Hampshire and Iowa.

Romney collected a number of states he was expected to win, including vote-rich Texas and the swing state of North Carolina, for a total of 206 electoral votes.

With many surveys showing a neck-and-neck matchup between Obama and Romney, the campaigns had braced for what could be a long night of counting returns. See MarketWatch live coverage of Election Day.

Markets had a strong Election Day, with the Dow Jones Industrial Average closing about 1% higher. However, stock futures overnight were pointing to a weaker start after the Obama victory. Read Indications.

A Romney supporter rubs his head as voting returns are announced at the election night rally for U.S. Republican presidential nominee Mitt Romney in Boston, Massachusetts November 6, 2012. Reuters

In addition to the presidential race, a number of key Senate races went the Democrats’ way. But the GOP retained control of the House, meaning that after billions of dollars spent on 2012 campaigns, there would be no shift in power this election season.

Two Republican tea-party favorites who made controversial remarks about rape were headed for defeat in their Senate contests. The candidates made the remarks in reference to abortion in the cases of rape and incest.

AP said Democrat Joe Donnelly beat Republican Richard Mourdock in Indiana, taking a seat long held by venerable GOP stalwart Richard Lugar. Lugar lost in the primary to Mourdock, who then lost ground with voters after saying publicly that it’s God’s will when a rape victim is impregnated.

Networks said Democrat Claire McCaskill was projected to retain her seat in Missouri after a hard-fought race with Rep. Todd Akin. Similar to Mourdock, Akin said that rape victims have the capability shutting down their reproductive systems when sexually assaulted.

A series of high-price Senate races also went the Democrats’ way. In one, former Virginia Gov. Tim Kaine defeated another former governor of the state and a former senator, George Allen. Read story on costliest Senate races.

Jubilation in New York for Obama

Elsewhere, Democrat Elizabeth Warren unseated U.S. Sen. Scott Brown in Massachusetts. Sen. Sherrod Brown retained his seat in Ohio, beating State Treasurer, Josh Mandel. Democrat Tammy Baldwin, a seven-term congresswoman, defeated former Gov. Tommy Thompson in Wisconsin. And, pro wrestling magnate Linda McMahon failed in her second bid for a Senate seat in Connecticut, losing to Democratic Congressman Chris Murphy.

Analysts say a close outcome of Tuesday’s elections would not give either party a mandate to push tax and spending proposals through Congress.

“If so, the final weeks of 2012 are likely to be characterized by intense political wrangling over how to prevent the economy from falling off [the] ‘fiscal cliff’ at the beginning of next year, which would otherwise occur under current law,” said a note from Capital Economics.

“A compromise at the 11th hour seems likely. But in the meantime, the uncertainty could keep the heat on the U.S. stock market,” the note said.