Former Labor Secretary Thomas E. Perez was elected chairman of the Democratic National Committee on Saturday, narrowly defeating Representative Keith Ellison of Minnesota to take the helm of a still-divided party stunned by President Trump’s victory but hopeful that it can ride the backlash against his presidency to revival.
The balloting, which carried a measure of suspense not seen in the party in decades, revealed that Democrats have yet to heal the wounds from last year’s presidential primary campaign. Mr. Perez, buoyed by activists most loyal to former President Barack Obama and Hillary Clinton, won with 235 votes out of 435 cast on the second ballot.
Mr. Ellison, who was lifted primarily by the liberal enthusiasts of Senator Bernie Sanders of Vermont, captured the remaining 200 votes. But that was only after he had pushed the voting to a second round after Mr. Perez fell a single vote short of winning on the first ballot.
After Mr. Perez’s victory was announced, Mr. Ellison’s supporters exploded in anger and drowned out the interim chairwoman, Donna Brazile, with a chant of “Party for the people, not big money!” When Mr. Perez was able to speak, he immediately called for Mr. Ellison to be named deputy chairman, delighting Mr. Ellison’s supporters.
Taking the microphone from Mr. Perez, Mr. Ellison pleaded with his fervent backers: “We don’t have the luxury to walk out of this room divided.”
In his victory speech, Mr. Perez played down what he called “the robust discussions in the Democratic Party.” “We’re all going to continue to be united in our values,” he said, calling the party’s “big tent” an asset.
Mr. Perez, 55, the son of Dominican immigrants, is the first Latino chairman of the Democratic Party. He was reared in Buffalo and has held a series of state and federal government jobs, most recently as Mr. Obama’s labor secretary.
Despite his limited experience in electoral politics, his calls for rebuilding the grass-roots and fostering a party that “makes house calls again” appealed to the party insiders who have watched as the House, the Senate and finally the presidency slipped away.
Addressing reporters with Mr. Ellison after the election, Mr. Perez vowed to shift the committee from its overriding focus on presidential politics.
“We’re no longer simply the committee that helps elect the president; we’re the committee that helps to ensure we’re electing people up and down the Democratic ticket,” he said, switching to Spanish for a time.
Neither of the two, by this point wearing each other’s campaign buttons, laid out Mr. Ellison’s role at the party, but they intimated that they had discussed joining forces before the vote. Directly appealing to his disappointed supporters, Mr. Ellison said, “If they trust me, they need to come on and trust Tom Perez as well.”
Mr. Ellison, who said he would not quit his House seat for the deputy chairman position, added, “The very fate of our nation, I believe, is in the balance right now.”
Mr. Trump used a lighter tone in offering up his response to the Democratic National Committee’s election. “Congratulations to Thomas Perez, who has just been named Chairman of the DNC,” the president wrote on Twitter. “I could not be happier for him, or for the Republican Party!”
Mr. Perez’s victory was the culmination of a more than three-month campaign that began when Democrats were still shellshocked over losing the presidential race. All of the major candidates argued against any turn toward moderation, and they shared the same strategic vision for reviving a national committee and state parties that had withered under Mr. Obama.
What was expected to be a robust debate over the way forward for a party shut out of power across much of the country was soon diminished by the larger, more immediate matter of Mr. Trump’s almost daily provocations and the raging backlash to his hard-line agenda.
Entering the race immediately after Mr. Trump’s win, Mr. Ellison, a prominent surrogate for Mr. Sanders in the presidential primary race, quickly won support from him and other leading liberals. Allies of Mr. Obama, Mrs. Clinton and other establishment-aligned Democrats soon began casting about for an alternative. In December, Mr. Perez entered the fray, quickly winning praise from Mr. Obama and endorsements from a number of governors.
While voting members of the party are more closely linked to the establishment wing, Mr. Ellison kept the race close by consolidating liberals and picking up support from mainstream Democrats such as the Senate minority leader, Chuck Schumer of New York.
Mr. Perez, though, got a lift in the final days of the contest when the South Carolina Democratic Party chairman, Jaime Harrison, withdrew from the race and threw his support to him. Mr. Perez’s allies said they had enough votes to win on the first ballot, but a single committee member somehow missed the vote.
And Mr. Ellison’s effort was hurt when one of his aides sent a group text message to the committee members claiming that Mayor Pete Buttigieg of South Bend, Ind., who withdrew from the race before the first vote, had endorsed him, only to send a subsequent message with “CORRECTION” in capital letters acknowledging that Mr. Buttigieg had not.
The initial anger from Mr. Ellison’s supporters after the final results were announced was deeply embarrassing to party officials. Former Mayor R. T. Rybak of Minneapolis, the departing vice chairman of the committee, had to wade into the section of jeering activists to quiet them so Mr. Perez could announce his appointment of Mr. Ellison as his deputy.
Party chairman races have in recent years been tidier affairs, with trailing candidates often withdrawing before the election takes place. Indeed, Saturday’s vote marked the first time in over three decades that the outcome of a vote for chairman was unknown when the balloting began.
The attention of Democrats will now turn to a handful of special congressional elections and a pair of promising governor’s races this November in New Jersey and Virginia. But the most significant task ahead for Mr. Perez will come in 2018, when Democrats face a daunting Senate map, a more favorable House landscape and 36 governor’s races, many of which will help determine which party is best positioned to redraw legislative lines after the next census.
This year’s contest was shadowed by the hacking of the Democratic National Committee’s computer system last year by Russian intelligence services. That resulted in the disclosure that the party, under Mr. Obama’s handpicked chairwoman, Representative Debbie Wasserman Schultz of Florida, had sought to undermine Mr. Sanders’s candidacy.
Despite that prologue, the race was largely free of vitriol. It was so amiable, in fact, that Mr. Perez and Mr. Ellison shared dinner last week at a Washington restaurant. And after the news conference in Atlanta, they were seen exchanging cellphone numbers.
The two leading candidates recognized that committee members had little appetite to relive a Clinton-versus-Sanders race on a smaller scale.
To say nothing of the Trump-induced harmony. “President Trump is a pretty easy guy to work against for Democrats,” said William Shaheen, a veteran New Hampshire Democrat.