Donald Trump’s hopes of keeping control of Congress have taken a major blow after a Democrat claimed victory in a district the president won by 20 points in 2016.
Conor Lamb was just ahead of his Republican rival Rick Saccone in the Pennsylvania 18th district election with almost every vote counted.
The result was yet to be formally announced on Wednesday, with Mr Lamb only 641 votes ahead and a handful of postal ballots still to be logged.
But the closeness of the race in heartland Trump country has left Democrats jubilant and Republicans soul-searching ahead of the mid-term elections later this year.
The congressional seat was considered so solidly Republican in the past that the Democrats did not even stand a candidate in 2012 and 2014.
Mr Trump personally campaigned twice with Mr Saccone, including a tub-thumping rally on Saturday, and sent family members and key allies into the state.
Republicans also reportedly pumped more than $10 million into keeping a seat which overwhelming backed Mr Trump for president at the last election.
Experts credited a "blue wave" of Democratic support for the result and said Mr Trump risks losing his House of Representatives majority in November.
The special election was triggered when a pro-life Republican resigned after urging an aide he was having an affair with to seek an abortion.
It could take weeks before the result is announced with the Republicans consulting lawyers, but a recount is unlikely to be successful given that many votes were cast electronically.
Losing control of the House of Representatives would open Mr Trump up to possible impeachment proceedings, which are started in that chamber.
Democrats need to take around 24 more of the 435 House seats to get a majority, something achievable given historic results for presidents with low popularity ratings.
Taking the Senate, where the Republicans have a 51-49 majority, will prove trickier because far more sitting Democrat senators are up for re-election than their rivals.
The Pennsylvania result could also fuel a surge of retirements from incumbent Republicans who choose to walk away from their seats rather than face the prospect of defeat.
A Republican strategist told CNN: “If you’re sitting on a beach and you see a tsunami coming, there’s only so much you can fortify. The best strategy is to evacuate.”