WASHINGTON (AP) — A victorious President Barack Obama told Americans he had never been more optimistic. “The best is yet to come,” he said, ticking off his legislative goals of reforming the tax system, working to ease climate change, overhauling the nation’s immigration laws. ‘Not so fast, Mr. President,’ came the response from Republicans, who held their grip on a recalcitrant House of Representatives.

The first test of whether the deep partisan divide in the country can be narrowed flares immediately with the country facing before year’s end the absolute necessity of Democrats — under Obama’s leadership — working out a compromise with Republicans to avoid what has been termed the “fiscal cliff,” a series of automatic tax increases and spending cuts that might well push the slowly recovering U.S. economy back in to recession.

The glow of victory will quickly fade despite the president’s surprisingly easy win of a second term, even though he had led the country through a period in which the economy suffered through its biggest downturn since the 1930s Great Depression, a time of high anxiety among financially battered citizens and a stubbornly high level of unemployment that had only dipped slightly below 8 percent in the final months of the 2012 campaign.

That said, voters’ rejection of Republican challenger Mitt Romney and his party’s continuing drift to the far right of the political spectrum, will surely stimulate a deep reassessment among opposition politicians who have seen their coalition — dominated by diminishing numbers of white men — shrinking while the country moves through the passing decades toward a day when minorities — blacks and Hispanics and Asians — are the majority demographic. Obama’s second-term victory already was laid to massive minority support.

Obama’s re-election guarantees for the now the full implementation of his signature first-term legislative achievement, overhaul of the nation’s health care system, changes Republicans vowed to overturn. Likely, too, will be a continued U.S. foreign policy that depends on multinational partnerships in dealing with intractable issues like Syria’s civil war and Iran’s nuclear program. Romney said those tactics were a sign of American weakness.as weak. And China, facing its own leadership transition, should be relieved. Romney had pledged to declare it a currency manipulator, potentially leading to sanctions and escalating trade tensions.

But foremost in the two months left to the new year stands the “fiscal cliff.” The standing legislation that includes big tax increases for nearly all Americans and spending cuts next year, including big reductions in spending for the military and popular social programs, grew out of the government’s inability a year ago to reach a deal on slicing away at America’s skyrocketing budget deficit and more than $16 trillion debt. The automatic cuts and tax increases — a total of $800 billion — were put in place as Congress and the White House decided to push the problem beyond Tuesday’s election. They time-buying law was designed to serve as an incentive for both sides to deal seriously to avoid the fiscal chaos dictated by the “fiscal cliff” legislation at the start of 2013.

As he spoke in Chicago after his victory, Obama forecast the big fight to come, saying it will “inevitably stir up passions

“That won’t change after tonight, and it shouldn’t,” he said. “These arguments we have are a mark of our liberty.”

That puts a best face on what will be a brutal ideological fight.

House speaker John Boehner, reminding Americans that Republicans still hold high cards with their majority in the lower chamber of Congress.

Voters made clear there is no mandate for raising taxes. Obama has proposed imposing higher taxes on households earning over $250,000 a year, and that is what killed attempts at compromise a year ago.

Setting up a continuing legislative gridlock, Democrats held control of the Senate and able to trump conservative legislation that originates in the House. Even facing his continued role as leader of the Senate minority, Republican Sen. Mitch McConnell signaled a readiness at continued obstruction if the Democrats and the president don’t capitulate.

“The voters have not endorsed the failures or excesses of the president’s first term,” said McConnell, frosty in his postelection remarks. “Now it’s time for the president to propose solutions that actually have a chance of passing the Republican-controlled House and deliver in a way that he did not in his first four years in office.”

As the race was called for Obama, thousands of supporters in his hometown of Chicago hugged each other, danced and pumped their fists. Excited crowds gathered in New York’s Times Square and near the White House in Washington, drivers joyfully honking as they passed by.

But the celebration was not the overwhelming one of four years ago, when voters knew they were making history by electing America’s first black president.

It was a far cry from the Obama of four years ago, the son of a white American mother and a Kenyan father whose improbable election captivated the world with his message of hope and pledges of bipartisanship that would change the way things are done in Washington.

Those lofty ambitions quickly sank into the quagmire of the punishing economic recession and crashed into a Republican Party that, determined to deny Obama a second term, fought him at every turn.

Younger voters and minorities went to the polls at levels not far off from the historic coalition Obama assembled in 2008. And Hispanics made up 10 percent of the electorate, up from 9 percent four years ago. Republicans won less than 30 percent of the Hispanic vote and not even one in 10 black voters.

While many in Republican leadership were talking tough, others in the party spoke of needing to change their approach on issues including immigration.

Republicans have a “period of reflection and recalibration ahead,” Sen. John Cornyn, chairman of the National Republican Senatorial Committee, acknowledged.

But Obama’s narrow lead in the popular vote will make it difficult for him to claim a sweeping mandate. With returns from 94 percent of the nation’s precincts, Obama had 58 million, or 50 percent of the popular vote. Romney had 56 million, or 48 percent.

Romney tried to set a more conciliatory tone on his way off the national stage.

“At a time like this, we can’t risk partisan bickering,” Romney said after a campaign filled with it. “Our leaders have to reach across the aisle to do the people’s work.”

Those clashing views will soon face a pressing test as the government starts work on avoiding the fiscal cliff.

Looking back as he faces the future, Obama can take satisfaction that during his first term he pushed through an auto bailout, an economic stimulus plan and financial reform legislation aimed at curbing Wall Street’s excesses. He’s now intent on reducing the huge national debt while safeguarding crucial social programs and winning the fight to make high income Americans pay their “fair share” in taxes.

Romney, a multimillionaire who said his business success gave him the experience to fix the economy, had run on a platform of lowering taxes still further and easing regulations on businesses, saying it would spur job growth.

Obama had a sizeable victory where it mattered: in the competition for electoral votes. He had at least 303 votes to Romney’s 206. The president is chosen in a state-by-state tally of electors, not according to the nationwide popular vote, making such “battleground” states — which vote neither Republican nor Democrat on a consistent basis — particularly important.

Obama won seven of the nine battleground states where the rivals and their allies poured nearly $1 billion into dueling television commercials. One swing state, Florida, remained too close to call Wednesday.