Joe Biden overtook President Donald Trump in Pennsylvania on Friday, but the process of counting votes slowed to a crawl as officials finished tallying the overwhelming majority of mail ballots and had only provisional ballots and other votes that are slower to process remaining. And with Biden holding only a razor-thin advantage in the evening, the counting process that had the presidential race hanging in the balance looked set to stretch into a fifth day without resolution.

The Democratic nominee remained poised to capture the state’s 20 Electoral College votes, and with it, the presidency. He had about 28,000 more votes than Trump by Friday night, a lead of 0.4%.

“We don’t have a final declaration of victory yet. But the numbers tell us it’s clear.... We’re going to win this race,” Biden said in a short address from Wilmington just before 11 p.m., his first appearance on Friday. “We are going to win Pennsylvania.... We’re on track to over 300 electoral votes."

The president did not speak publicly Friday, but his campaign issued a statement:

“This election is not over. The false projection of Joe Biden as the winner is based on results in four states that are far from final.”

The weary, suspense-gripped nation watched as Philadelphia delivered the votes that pushed Biden past Trump in Pennsylvania just before 9 a.m. Friday — and for liberals, it prompted celebrations in the city’s streets and raucous praise for Philadelphia in social media memes. Outside the Pennsylvania Convention Center hall where Philadelphia’s votes are being counted, demonstrators unfurled a giant banner reading, “The people have spoken," and passed out signs that said “Trump must concede."

But instead of handing the nation an end to the long, fraught race, Pennsylvania ended up promising Americans at least another day of waiting, as vote counts were slow to come and the margin between the candidates remained tight. In Pennsylvania, the final margin must be greater than 0.5% to avoid a recount.

Elections officials did not provide the total number of votes left to be counted statewide by the end of the day Friday, but said most are provisional ballots. Philadelphia has about 40,000 ballots remaining, which officials said would take “several days” to count.

Biden could win without Pennsylvania, but the count in other key states also dragged on Friday. Biden was ahead in Nevada and Georgia, as well as in Arizona, which the Associated Press called for him on Wednesday. Trump remained up in North Carolina.

The wait for a final verdict didn’t dampen the joy of many Biden supporters in the city — from Mayor Jim Kenney, who called Biden the “winner,” to the drum-playing, sage-burning, sign-waving crowds that returned for a second day to party outside the Convention Center, to Biden voters in rural Pennsylvania.

“I love Philadelphia. From now on, I’m going for every Philly team,” said Louis V. Mascherma, 58, a military veteran and retired Postal Service worker in Southwestern Pennsylvania’s Westmoreland County, who on Friday afternoon was wearing a Pittsburgh Penguins ball cap. “I’m going to get rid of this Penguins hat, and I’m going to get a Philadelphia Flyers hat.”

As the Trump campaign continued its baseless attempts to undermine confidence in the election, Pennsylvania Republicans on Friday urged the U.S. Supreme Court to throw out a state Supreme Court ruling allowing mail ballots to be counted if received by 5 p.m. Friday. And GOP lawmakers escalated their criticism of the state’s top elections official — even as they acknowledged there is no evidence of fraud.

As on Thursday, a crowd of the president’s supporters demonstrated opposite the “Count Every Vote” protesters at the Convention Center, waving Trump flags, dancing, and holding signs with slogans such as “Only legal votes!”

In response to a Republican lawsuit alleging it was illegal for Pennsylvania counties to have given voters who submitted mail ballots with missing signatures or secrecy envelopes an opportunity to fix them, a state appellate court judge on Friday ordered all provisional ballots cast at the polls on Election Day by such voters to be segregated until a decision in the case.

Sen. Pat Toomey (R., Pa.) did not repeat Trump’s false claims of fraud, saying on NBC’s Today show that "the president’s allegations of large-scale fraud and theft of the election are just not substantiated.”

At the Convention Center, city officials praised the democratic process. Lisa Deeley, chair of the city commissioners, who run elections, said workers were continuing to count ballots as quickly as possible.

“While some, including the president, continue to spew baseless claims of fraud claims, for which his team has not produced one iota of evidence,” Kenney said, “what we’ve seen here in Philadelphia is democracy, pure and simple.”

Officials in the Philadelphia suburbs also pushed back against Trump. In a joint statement, Bucks County’s commissioners said that attacks on the integrity of the election undermine the hard work of county employees and residents.

And Delaware County officials debunked a conspiracy theory circulating on Twitter that an election worker there had “filled out” ballots. In reality, the worker was transcribing ballots that had been damaged and were unable to be fed into tabulation machines, as poll watchers from both parties observed, county spokesperson Adrienne Marofsky said.

Bucks County had about 4,000 mail ballots left to count; Delaware County had about 15,000 mail ballots; and Chester and Montgomery Counties had finished counting mail ballots and had provisional ballots to count.

The high number of provisional ballots cast this year is likely due to the number of mail ballots: Voters who requested a mail ballot but then decided to vote at a polling place instead were required to use a provisional ballot if they did not bring their mail ballot with them to be voided.

The daylong party at 12th and Arch Streets continued into the night. Biden’s win was all but certain to his supporters, who were already celebrating an end to the Trump presidency.

“This is amazing,” said Renee Wilson, 49, a laid-off hotel worker from South Philadelphia, adding she’d already cried a few times since morning. “This is what we needed. People who talk about Philadelphia being a bad place: Look at the people here.”

In South Philadelphia, Lisa Gerena said she was thanking “the good Lord that Biden is so close to winning Pennsylvania." She said she was hoping that, as president, Biden would “do something about this pandemic.”

In West Philadelphia, people on one block came out of their homes and danced when Biden took the lead. At 12th and Arch, Beth Hare, 61, of Bryn Mawr, was emotional.

“I think this is history in the making,” she said.

The celebration had begun in the morning with a prayer circle and volunteers with the Working Families Party handing out hundreds of yellow “Count Every Vote” sweatshirts, while a smaller number of Trump supporters gathered on the other side of a metal barricade. By evening, as the crowds swelled, about 100 pro-Trump demonstrators, at least 400 Biden supporters, and a slew of reporters were camped out on the street.

At the prayer circle, the Rev. Mark Kelly Tyler, of Philadelphia’s historic Mother Bethel AME Church, spoke of his Black ancestors, saying he was the first member of his immediate family born with the right to vote.

“My vote counts because they had no vote,” said Tyler, who was born a year after the 1965 Voting Rights Act. “They had no voice. They were used, but God has kept us here for such a time as this. And now the children of our ancestors are speaking in Atlanta, in Detroit, in Las Vegas, in Phoenix, and in the birthplace of democracy, Philadelphia, Pennsylvania.”

The hundreds listening cheered and applauded. Others were weeping.

“We will not be silenced!” Tyler said. “Our vote counts!”

Staff writers Rob Tornoe, Jeremy Roebuck, Sean Collins Walsh, Maddie Hanna, Ellie Silverman, Vinny Vella, Laura McCrystal, Brandon T. Harden, Jonathan Lai, and Oona Goodin-Smith contributed to this article, along with Angela Couloumbis of Spotlight PA.