NEW YORK — Donald J. Trump shocked the world Tuesday, winning election as the 45th president of the United States.

The Republican nominee’s victory came after projections showed him winning the states of Florida and North Carolina, as well as Wisconsin, which a Republican nominee had not won in decades.

ADVERTISEMENT

Trump, once again, defied all the predictions.

His condemnations of the political establishment and his insistence that he alone can restore American greatness resonated with voters far from the media epicenters of the east and west coast. They came out in huge numbers to lift him to victory in the key battleground states. Jubiliation built throughout the evening at his election night headquarters at a midtown Manhattan hotel

Trump’s win is a huge upset to virtually everyone but the ebullient candidate himself. Clinton had led by around three points in the national polling averages as Election Day dawned, and some data prediction websites had put her chances of victory around 90 percent.

Polling organizations will face hard questions as to how they misread Trump’s backing so badly, even though aides to the candidate had long insisted that there were “shy” supporters who were not admitting their allegiances.

It’s not the first time the billionaire real estate magnate has upset the odds. When he began his White House bid in June 2015, pundits and political professionals derided his chances. They were proven wrong, in the first instance, when he won the GOP nomination against a large field that included several more seasoned rivals. They have been proven wrong in even more emphatic fashion now that he is president-elect.

Trump’s supporters, unswerving in their loyalty toward him, have opted for a man who framed his lack of formal political experience as an asset. He has never sought political office before.

But a plurality of voters have accepted his central arguments: that the American system is broken or rigged, that the U.S. has been weakened on the world stage; and that only a man of Trump’s force of personality — and distaste for political correctness — is capable of putting things right.

The result amounted to a political earthquake. “This is the end of the old establishment that has been running this country for years,” exulted Carl Paladino, a former gubernatorial candidate in New York and a Trump supporter. “This is about an uprising of the middle class in America and about saying, ‘Enough is enough, we’ve had enough of your bullshit.’”

President-elect Trump will be leading a deeply divided nation, however. His campaign ignited fierce opposition as well as support. Polls on personal favorability showed repeatedly that he was the most disliked major-party nominee of modern times — though Clinton was a close second.

His detractors contend that he has no respect for democratic norms, and that he has introduced xenophobia and bigotry into the political mainstream.

In January, he will succeed President Obama, a man who is his polar opposite temperamentally as well as ideologically. Trump’s first forays into the political arena called Obama’s birthplace into question, without evidence. Obama, for his part, made his disdain for Trump clear as he campaigned on Clinton’s behalf.

Now Trump will take office on the promise of undoing large chunks of Obama’s legacy. His most famous campaign promise is to erect a wall along the southern border with Mexico. He has also pledged to repeal Obama’s signature legislative achievement, the Affordable Care Act, or ObamaCare.

Trump has said that he will put in place “extreme vetting” for people entering the United States from countries connected to terrorism. This proposal is a modification of an earlier call to ban Muslims from coming into the country — a statement that caused one of the many furors that dogged Trump’s campaign.

At a personal level, the presidency is an extraordinary capstone to a life lived large. Trump first found fame as a New York property developer. He got his start in that business from this father, who had mostly concentrated on turning profits in the less fashionable borough of Queens. That would not satisfy his son, who turned his sighs to Manhattan, erecting gleaming skyscrapers that bore his name.

Trump would branch out from real estate into numerous other businesses, from golf courses and casinos to steaks and mortgages. Several such ventures failed but enough of them succeeded to keep Trump’s name in the news — a goal that he has long treated as a personal imperative.

His celebrity found its purest form during his years as the star of the NBC show “The Apprentice,” in which contestants sought to impress him with their business acumen and avoid what became his signature admonition: “You’re fired!”

The show indirectly led to his worst moment of the presidential campaign, however. In October, a video from 2005 emerged, in which Trump was heard boasting to TV anchor Billy Bush about how his fame enabled lecherous behavior toward women.

“When you’re a star, they let you do it,” Trump was heard telling Bush. “You can do anything. Grab ‘em by the p - - - y. You can do anything.”

The storm that followed almost capsized his campaign, as Republicans rushed to distance themselves from the party nominee. But Trump stabilized matters with a feisty performance in the second presidential debate against Clinton.

He went on to narrow her poll lead in the final stretch of the campaign, assailing her as the emblem of a corrupt system. He also took advantage of a late announcement from the FBI that it was investigating new emails sent or received by Clinton at a private email address she used while secretary of State. A later announcement that nothing incriminating had been found in those messages clearly did not slow the GOP nominee's gains.

Trump defined much of his campaign by what he was against: the GOP establishment, the media, the elites and, of course, Clinton herself. Now he must turn his attention to leading the nation.

He will face enormous challenges. But his achievement in winning the election on Tuesday shows just how dangerous it is to bet against him.