WASHINGTON (AP) — A day after Donald Trump, against all odds, won election as America’s 45th president, Hillary Clinton on Wednesday lamented that the nation proved to be “more divided than we thought” but told supporters: “We owe him an open mind and a chance to lead.”

Standing before a crowd of crestfallen campaign aides and backers, Clinton said, “This is painful and it will be for a long time.”

Trump’s triumph, declared after midnight, will end eight years of Democratic control of the White House. He’ll govern with a Republican-controlled Congress and lead a country deeply divided by his rancorous campaign against Clinton. He faces fractures within his own party, too, given the numerous Republicans who wouldn’t back him or only tepidly supported his nomination.

Claiming victory early Wednesday, Trump urged Americans to “come together as one united people.”

That sentiment was echoed by the GOP House Speaker Paul Ryan, who had been a reluctant Trump supporter. “This needs to be a time of redemption, not a time of recrimination,” Ryan said in a news conference, crediting Trump with earning a “mandate” to enact his agenda.

Clinton, hoping to become the first woman to be elected president, conceded defeat in a telephone call to Trump.

With several million votes still to be counted, she held a narrow lead in the nationwide popular vote. Most of the outstanding votes appeared to be in Democratic-leaning states, with the biggest chunk in California, a state Clinton overwhelmingly won. With almost 125 million votes counted, The Associated Press tally had Clinton with 47.7 percent and Trump with 47.5 percent.

Summoning her most magnanimous tone after a bitter race, Clinton said of the man whose victory she declared would be a danger to America and the world: “I hope that he will be a successful president for all Americans.”

As her supporters waited for her in a New York ballroom, the scene of despair played out for all on live television. Cameras zoomed in on the exhausted and miserable faces of several of her closest aides, some dressed in hoodies or other casual clothing. The familiar campaign music of Bruce Springsteen in the background added to the sense of disappointment.

“We have seen that our nation is more deeply divided than we thought,” Clinton said in a speech she never hoped to deliver. “But I still believe in America and I always will.”

Global stock markets and U.S. stock futures plunged early Wednesday, but later recovered. The Dow Jones industrial average was up almost 1 percent in midday trading in New York.

President Barack Obama congratulated Trump in a phone call and invited him to a meeting at the White House Thursday.

In the Rose Garden Wednesday, Obama said he had significant differences with Trump, as he had with George W. Bush upon taking office eight years ago. But he promised a smooth transition.

“Everybody is sad when their side loses an election,” said Obama, who risks seeing much of his legacy reversed in a Trump administration. “The day after, we have to remember we’re actually all on one team.”

Trump, who spent much of the campaign urging supporters on as they chanted “lock her up,” said the nation owed Clinton “a major debt of gratitude” for her years of public service.

A New York real estate developer who lives in a sparkling Manhattan high-rise, Trump forged a connection with white, working class Americans who feel left behind in a changing economy and diversifying country. He cast immigration, both from Latin America and the Middle East, as the root of problems plaguing many Americans and tapped into fears of terrorism emanating at home and abroad.

GOP Senate candidates fended off Democratic challengers in key states, including North Carolina, Indiana and Wisconsin. Republicans maintained their grip on the House.

Senate control means Trump will have leeway in appointing Supreme Court justices, potentially shifting the bench to the right for decades.

He has pledged to introduce sweeping changes to U.S. foreign policy, including building a wall along the U.S.-Mexico border. He has praised Russian President Vladimir Putin and advocated a closer relationship with Moscow, worrying some in his own party who fear he’ll go easy on Putin’s provocations.

Putin sent Trump a telegram of congratulations.

Upending years of political convention on his way to the White House, Trump repeatedly insulted his rivals, declared Mexican immigrants rapists and murderers, and vowed to suspend Muslim immigration to the U.S. He never released his tax returns and ignored the kind of robust data and field efforts that propelled Obama to two White House terms, relying instead on large, free-wheeling rallies to energize supporters. His campaign was often in chaos.

Clinton faced persistent questions about her honesty and trustworthiness. And her troubles flared anew late in the race, when the FBI reviewed new emails from her tenure at the State Department. Just two days before Election Day, the bureau’s director said nothing in the material warranted criminal charges.

Women nationwide supported Clinton by a double-digit margin, while men significantly backed Trump. Nearly nine in 10 blacks and two-thirds of Hispanics voted for Clinton.