Oz received 419,999 votes (31.1%) while McCormick received 419,048 votes (31.0%), the acting secretary of state said in A press release Wednesday evening. Vote totals within a half percent (0.5%) margin automatically trigger a mandatory recount.

Oz will face Democratic Lieutenant Governor John Fetterman in one of the Senate’s headline races in this year’s midterm elections. Republicans see retaining incumbent GOP Sen. Pat Toomey’s seat as key to their hopes of winning a Senate majority, while Democrats see the rollover of seats in Pennsylvania and Wisconsin, the two states carried by the current President Joe Biden in 2020, as the best way to hedge against losses elsewhere.

“With the statewide recount officially over, it’s time to focus on how big the stakes are in November,” Oz said in a statement Wednesday.

“I look forward to continuing my campaign in our great Commonwealth to win the support of Pennsylvanians who want someone who will oppose the liberal Biden-Fetterman agenda leading to rising gas prices, inflation record and unprecedented levels of violent crime,” he added.

The Oz campaign had faced a series of attacks over his reversals on abortion rights, which he once said he supported and now says he opposes, and his Turkish citizenship and his service in the Turkish army.

While his lead candidacy was bolstered by an endorsement from Trump, who campaigned for him days before the election, the Pennsylvania race exposed rifts within the GOP, with the former president endorsing a candidate seen as more moderate than the other candidates.

Kathy Barnette, the conservative commentator whose throaty embrace of all that Trump stood for drew supporters who weren’t in love with Oz, finished third with about 25% of the vote.

Beyond the senatorial contest, the Commonwealth is also hosting a crucial race for governors that pits Republican Senator Doug Mastriano, who has embraced Trump’s lies about the 2020 presidential election, against Democratic Attorney General Josh Shapiro, who has defended the state’s electoral procedures. with the winner gaining the power to appoint the Secretary of State who will take control of Pennsylvania’s electoral machinery in time for the 2024 presidential contest.

This story was updated with additional information on Wednesday.

CNN’s Eric Bradner contributed to this report.