Doug Jones has become the first Democrat in 25 years to win a US Senate seat for Alabama after a bitter campaign against Republican Roy Moore.
His unexpected victory deals a blow to President Donald Trump, who backed Mr Moore, and narrows the Republican majority in the Senate to 51-49.
With 99% of the votes counted, Mr Moore refused to concede on Tuesday night.
He fought a controversial campaign, in which allegations surfaced of sexual misconduct with teenage girls.
Mr Moore, a firebrand conservative who has said he believes that homosexual activity should be illegal, has repeatedly denied the claims against him.
Why hasn’t Roy Moore conceded?
Many media outlets have reported the election in favour of Mr Jones, and 99% of the votes have been counted.
But Mr Moore, 70, told his supporters it was not yet over.
“We’ve been painted in an unfavourable and unfaithful light,” he said. “Realise that when the vote is this close that it’s not over.”
He said he believed the margin of victory could narrow as more votes poured in, which could trigger an automatic recount.
Alabama Secretary of State John Merrill said a recount could be ordered if the margin is narrowed to less than half a percentage point.
Although Mr Moore did not concede, President Trump congratulated Mr Jones in a tweet shortly after US media declared him the winner, adding that “Republicans will have another shot at this seat in a very short period of time”.