Joseph Robinette Biden Jr. was elected the 46th president of the United States on Saturday, promising to restore political normalcy and a spirit of national unity to confront raging health and economic crises, and making Donald J. Trump a one-term president after four years of tumult in the White House.

Mr. Biden’s victory amounted to a repudiation of Mr. Trump by millions of voters exhausted with his divisive conduct and chaotic administration, and was delivered by an unlikely alliance of women, people of color, old and young voters and a sliver of disaffected Republicans. Mr. Trump is the first incumbent to lose re-election in more than a quarter-century.

The result also provided a history-making moment for Mr. Biden’s running mate, Senator Kamala Harris of California, who will become the first woman to serve as vice president.

With his triumph, Mr. Biden, who turns 78 later this month, fulfilled his decades-long ambition in his third bid for the White House, becoming the oldest person elected president. A pillar of Washington who was first elected amid the Watergate scandal, and who prefers political consensus over combat, Mr. Biden will lead a nation and a Democratic Party that have become far more ideological since his arrival in the capital in 1973.

He offered a mainstream Democratic agenda, yet it was less his policy platform than his biography to which many voters gravitated. Seeking the nation’s highest office a half-century after his first campaign, Mr. Biden — a candidate in the late autumn of his career — presented his life of setback and recovery to voters as a parable for a wounded country.

In a brief statement, Mr. Biden called for healing and unity. “With the campaign over, it’s time to put the anger and the harsh rhetoric behind us and come together as a nation,’’ he said. “It’s time for America to unite. And to heal. We are the United States of America. And there’s nothing we can’t do, if we do it together.”

The race, which concluded after four tense days of vote-counting in a handful of battlegrounds, was a singular referendum on Mr. Trump in a way no president’s re-election has been in modern times. He coveted the attention, and voters who either adored him or loathed him were eager to render judgment on his tenure. Americans rarely turn incumbent presidents out of office, but from the beginning to the end of the race, Mr. Biden made the president’s character central to his campaign.

This unrelenting focus propelled Mr. Biden to victory in historically Democratic strongholds in the industrial Midwest,with Mr. Biden forging a coalition of suburbanites and big-city residents to claim at least threestates his party lost in 2016.

Yet even as they turned Mr. Trump out of office, voters sent a more uncertain message about the left-of-center platform Mr. Biden ran on as Democrats lost seats in the House and made only modest gains in the Senate. The divided judgment — a rare example of ticket-splitting in partisan times — demonstrated that, for many voters, their disdain for the president was as personal as it was political.

Even in defeat, though, Mr. Trump demonstrated his enduring appeal to many white voters and his intense popularity in rural areas, underscoring the deep national divisions that Mr. Biden has vowed to heal.

The outcome of the race came into focus slowly as states and municipalities grappled with the legal and logistical challenges of voting in the midst of the coronavirus pandemic. With an enormous backlog of early and mail-in votes, some states reported their totals in a halting fashion that in the early hours of Wednesday painted a misleadingly rosy picture for Mr. Trump.

But as the big cities of the Midwest and West began to report their totals, the advantage in the race shifted the electoral map in Mr. Biden’s favor. By Wednesday afternoon, the former vice president had rebuilt much of the so-called blue wall in the Midwest, reclaiming the historically Democratic battlegrounds of Wisconsin and Michigan that Mr. Trump carried four years ago. And on Saturday, with troves of ballots coming in from Philadelphia and Pittsburgh, he took back Pennsylvania as well.

While Mr. Biden stopped short of claiming victory as the week unfolded, he appeared several times in his home state, Delaware, to express confidence that he could win, while urging patience as the nation awaited the results. Even as he sought to claim something of an electoral mandate, noting that he had earned more in the popular vote than any other candidate in history, Mr. Biden struck a tone of reconciliation.

It would soon be time, he said, “to unite, to heal, to come together as a nation.”

In the days after the election, Mr. Biden and his party faced a barrage of attacks from Mr. Trump. The president falsely claimed in a middle-of-the-night appearance at the White House on Wednesday that he had won the race and that Democrats were conjuring fraudulent votes to undermine him, a theme he renewed on Thursday evening in grievance-filled remarks conjuring up, with no evidence, a conspiracy to steal votes from him.

The president’s campaign aides adopted a tone of brash defiance as swing states fell to Mr. Biden, saying they would demand a recount in Wisconsin and take legal action to stop vote counting in Michigan and Pennsylvania.On Friday morning, Mr. Trump’s campaign issued a statement vowing to press forward with legal challenges and declaring, despite the erosion of his leads in Pennsylvania and Georgia,“This election is not over.”

Though Mr. Trump’s ire had the potential to foment political divisions and even civil unrest, there was no indication that he could succeed with his seemingly improvisational legal strategy.

In the end, it was Pennsylvaniathat provided Mr. Biden the necessary 270th Electoral College vote to claim victory, with Mr. Biden leading by over four million votes nationwide.

Through it all, the coronavirus and its ravages on the country hung over the election and shaped the choice for voters. Facing an electorate already fatigued by his aberrant conduct, the president effectively sealed his defeat by minimizing a pandemic that has created simultaneous health and economic crises.

Beginning with the outbreak of the virus in the country at the start of the year, through his own diagnosis last month and up to the last hours of the election, he disregarded his medical advisers and public opinion even as over 230,000 people in the United States perished.

Mr. Biden, by contrast, sought to channel the dismay of those appalled by Mr. Trump’s mismanagement of the pandemic. He offered himself as a safe harbor for a broad array of Americans, promising to guide the nation out of what he called the “dark winter” of the outbreak, rather than delivering a visionary message with bright ideological themes.

While the president ridiculed mask-wearing and insisted on continuing his large rallies, endangering his own staff members and supporters, Mr. Biden and Ms. Harris campaigned with caution, avoiding indoor events, insisting on social distancing and always wearing masks.

Convinced that he could win back the industrial Northern states that swung to Mr. Trump four years ago, Mr. Biden focused his energy on Michigan, Wisconsin and Pennsylvania. Mr. Biden triumphed in those states on the strength of overwhelming support from women, who voted in large numbers to repudiate Mr. Trump despite his last-minute pleas to “suburban housewives,” as he called them.

Many of the women who decided the president’s fate were politically moderate college-educated suburbanites, who made their presence felt as an electoral force first in the 2018 midterm elections, when a historic wave of female candidates and voters served as the driving force behind the Democratic sweep to power in the House.