From the first days of his presidential campaign, Joe Biden made it clear that winning back Pennsylvania was central to his strategy for winning the White House.

He held his first big event at a Teamsters union hall in Pittsburgh and staged an early rally in Philadelphia. He campaigned in Pennsylvania more than any other state, visiting not just the deeply Democratic cities, but also postindustrial areas around Johnstown and his native Scranton, where white working-class voters had shunned Democrats for Donald Trump.

It was close, but it paid off. He narrowly won Pennsylvania, which sealed his national victory and made him president-elect. Biden led the state by about 37,000 votes Saturday, an edge of less than 1 percentage point. In a state decided by such small margins in 2016 and again this year, an array of factors combined to create the outcome.

Take any of them out, and Trump might have won again.

Biden rebounded, compared with Hillary Clinton, in coal and steel country, often keeping pace with Trump’s rising support there. Trump modestly improved his performance in Philadelphia. But the city still cast more than 550,000 votes for Biden as a mix of voters from the full spectrum of racial identities and economic classes stood in lines to defeat a president who had stoked racial divisions and downplayed the coronavirus — each of which had scarred the city.

But the suburbs delivered Biden’s biggest gains.

The four Philadelphia collar counties gave Biden a 283,000-vote advantage, a 50% increase from Clinton’s four years ago, and more than double the margin President Barack Obama enjoyed in 2012. Allegheny County, home to Pittsburgh and its affluent suburbs, boosted Biden’s margin by 30,000 votes compared with Clinton’s, a 28% increase, with votes still being counted.

“People came out in droves to vote ‘yes’ for decency and to reject the indecency of this president,” said U.S. Rep. Madeleine Dean, a Montgomery County Democrat who was part of a wave of women elected to Congress in 2018.

Immediately after Trump’s election, suburbs became a hotbed of activism driven by women who ran for office, donated money, and volunteered for campaigns. Despite Trump’s warning that Biden would “destroy” the suburbs, women there rejected what they saw as Trump’s racism, misogyny, cruelty, and dishonesty.

Speaking shortly after Trump’s defeat was sealed, Dean choked up.

“I am here at my granddaughter’s soccer game," she said. "I feel so happy for her, so happy for her generation. We have rejected a corrupt, self-serving individual as the leader of our nation. I want her to see leaders they can model.”

Drawn by Biden’s promises of decency, competence, and empathy — and driven by Trump’s frequently racist rhetoric and mishandling of the pandemic — a surge of Pennsylvanians cast more than 3.3 million votes for Biden, helping him narrowly win the state, and the presidency, over a president who drew similarly fervent support.

Lindsay Dixon just didn’t get around to voting in 2016. But on Election Day this year, she finished her nursing shift at St. Luke’s Hospital in Bethlehem at 7:30 p.m. and raced straight to the polls.

“I didn’t care about waiting, I didn’t care I was tired, I really just knew I had to vote,” said Dixon, 31.

Bob Banion, a lifelong Republican, had voted for Trump in 2016, but now the 68-year-old sales manager from Montgomery County wanted a president with “more class, more dignity.” He voted for Biden.

And while more than two million Pennsylvanians voted by mail, Janelle Purnell, 26, stood in a long line at her polling place in Philadelphia’s Overbrook section because she wanted be sure her vote was counted. “I would like a president who doesn’t rant on Twitter with dog whistles against minority groups,” she said. “And I would like to feel less embarrassed to be an American.”

Trump’s support also grew, as more than three million voters wanted four more years of his leadership. But it wasn’t quite enough in the face of a multiracial coalition that backed Biden, from the state’s traditionally liberal cities, to its surging suburbs, to rural areas and small towns, where Biden ate into Trump’s white working-class support.

There was historic turnout, inspired by Trump on both sides — those who flew his flags and cheered at his rallies, and those desperate to be rid of him.

Amid a still-raging pandemic and widespread economic pain, with social unrest over racial inequality roiling the country, many voters across the state embraced Biden’s seemingly simple pitch: a steady presence that, they hoped, would restore a semblance of normalcy.

“He was far more empathetic. Just the way he presented the campaign. Trump was yelling and screaming and calling names," said Richard Brown, 66, a retired Teamster from Luzerne County, in the state’s northeast. Brown described himself as socially conservative, including on abortion, but he voted for Biden.

“I’m not a liberal by no means, but I’m a Democrat,” he said.

Dixon, the nurse from Bethlehem, recounted how talking with the Trump supporters in her family had become difficult, particularly when it came to the pandemic.

“Even if I tell them about the hospital, they’re very attached to a certain mind-set around Trump," she said. "They just can’t admit there’s anything negative about him.”

Race also became a huge factor for voters like her. “My son is half Black,” she said. “It’s not just my husband, I also have to think about what’s right for him.”

Turning out voters like Dixon who sat out 2016 was crucial, since Trump’s support rose even higher than in the last election.

“There’s no other president since the founding fathers who has upheld life, liberty, and the pursuit of happiness,” Rochelle Porto, a teacher and Trump supporter, said outside a polling place at Bensalem High School, in Bucks County. Many Trump backers said Saturday that the turnout he achieved shows he will remain a political force and the leader of the party.

Activists with the group Progress PA demonstrate in September on Route 19 in Wexford, Pa., outside Pittsburgh.
TOM GRALISH / Staff Photographer
Activists with the group Progress PA demonstrate in September on Route 19 in Wexford, Pa., outside Pittsburgh.

As the campaign reached its final weeks, Pennsylvania, like many states, saw huge spikes in coronavirus cases. Trump returned repeatedly for massive rallies where supporters crowded shoulder-to-shoulder, most, like him, without face masks. He falsely said for months that the country was “rounding the turn” on the pandemic, even as cases and deaths mounted.

Biden held smaller, socially distanced events, and made a point of wearing a mask in public.

In an older state where senior citizens vote reliably, many abandoned Trump.

“He played it smart with the virus,” said Mike Mikus, a Democratic operative from Western Pennsylvania. “He took the virus seriously.”

Biden, Democrats said, also fit the profile of a vast state that often favors moderates.

While many Democratic primary competitors were rushing left to embrace the Green New Deal or Medicare for All, Biden demurred. He refused to support calls to ban fracking or “defund” the police.

“Biden always had a strong case to be made that he was the Democrat likeliest to carry Pennsylvania, and his win vindicates that,” said J.J. Balaban, a Democratic strategist based in Philadelphia.

Pennsylvania is, after all, a state that has elected moderate Democrats such as Gov. Tom Wolf and Sen. Bob Casey, and Republicans like former Gov. Tom Ridge and the late Sen. Arlen Specter.

“We were a lot more cognizant of the difficulty of beating Donald Trump in Pennsylvania because of what happened in 2016," said Casey, a fellow Scrantonian. “So you had to have a strategy that I think Joe Biden’s campaign implemented remarkably well: that you’d run really strong in rural areas, cut the margin, and do well in your Democratic base.”

Biden never failed to remind voters of his Scranton roots and played up his blue-collar image, as the son of a used-car salesman who, unlike many other national leaders, didn’t attend an Ivy League college.

Jim Wertz, the Democratic chairman in Erie County, recalled how Biden spoke about the economic struggles at Wabtec, a major locomotive manufacturer, when he visited in October.

“He has a better... read on the temperature of communities like ours, than a lot of other politicians might,” Wertz said.

Erie, in the state’s northwest corner, along with Luzerne and Lackawanna, in the state’s northeast, were traditionally Democratic, blue-collar counties that saw the three largest vote swings to Trump in 2016, driving his victory. Biden improved in each.

He swung Erie back just enough, winning by 1,300 votes, less than a percentage point — much like the state overall.

In Lackawanna County, home to Scranton, Biden led by 9 percentage points Saturday. Clinton won the county by just 3. In neighboring Luzerne, Biden still lost, but was down by 15 points Saturday. Trump won it by 20 in 2016.

Supporter Ceyonna Rybitski celebrates from a car as she passes others gathered in front of Joe Biden’s childhood home in Scranton on Saturday, Nov. 7, 2020, after news outlets projected Biden the Pennsylvania winner.
TIM TAI / Staff Photographer
Supporter Ceyonna Rybitski celebrates from a car as she passes others gathered in front of Joe Biden’s childhood home in Scranton on Saturday, Nov. 7, 2020, after news outlets projected Biden the Pennsylvania winner.

American Bridge, a Democratic Super PAC, spent $32 million advertising on television, radio, and digital platforms in Pennsylvania, featuring local Trump supporters who now planned to oppose the president. The goal was to create a “permission structure” for Trump supporters to break with the president, and trim Democratic losses with rural, white voters, said Bradley Beychok, the group’s president.

“You want to know that your neighbor or your colleague or someone that you can see that goes to your church, if they have changed their mind, it makes you more likely to do so,” Beychok said.

Balaban said there were likely uglier reasons, too, why Biden may have performed better.

“Pennsylvania has a type ... and Joe Biden is clearly our type," he said. "There are some troubling racial and gender implications of that.”

A huge piece of Biden’s support also came from older Black voters, the traditional backbone of the Democratic Party. Black women, in particular, said they were motivated by a pandemic disproportionately affecting Black and brown communities, and Trump fanning the flames of racism amid a national reckoning on civil rights.

“I’ve never seen or experienced anything like what we are going through right now — a country divided," Vivian McDuffie, who has lived in West Philadelphia for more than 40 years, said on Election Day. "I grew up in a time that was on the tail end of that, but to live long enough to see it happening again, there is something very wrong and voting should correct it.”

Biden’s running mate, Sen. Kamala Harris, will become the first woman, first Black person, and first American of South Asian descent to serve as vice president.

Overall, though, exit polls suggested Trump improved nationwide with Black and Latino voters. And while some mail and provisional ballots were still being counted, it appeared this would be the third consecutive presidential election in which the number of Democratic votes has declined in Philadelphia.

Given the slim margin that took Biden to victory, many Democrats were celebrating with the knowledge that Pennsylvania is still very divided.

“These are the types of towns we need to nurture," Scranton Mayor Paige Cognetti said as she looked out at revelers during a block party celebrating Biden’s win in his hometown. “And with how close it was, I mean that doesn’t go away. We’ve got our work cut out for us. But I think Joe Biden’s the president for that."

Staff writers William Bender, Allison Steele, Sean Collins Walsh, and Raishad Hardnett contributed to this article.