Republican Cindy Hyde-Smith has won Mississippi’s racially charged Senate election, beating a challenge from the black Democrat, Mike Espy.
It extends the Senate majority of President Donald Trump’s party to 53, compared with the Democrats’ 47.
The race narrowed after Ms Hyde-Smith, who is white, was recorded saying she would happily attend a public hanging.
The comments evoked the lynching of African-Americans in a state scarred by a history of racial violence.
With nearly all votes counted, Ms Hyde-Smith had taken 54.4% of the vote compared to 45.6% for Mr Espy.
President Trump tweeted his congratulations.
In a statement, Ms Hyde-Smith said: “I want everybody to know, no matter who you voted for today, I am going to represent every Mississippian.”
For many, the comment evoked past lynchings of African-Americans.
According to the National Association for the Advancement of Colored People (NAACP), Mississippi had the highest number of lynchings in the nation from 1882 to 1968.
A video of Ms Hyde-Smith – who was the first ever US congresswoman from Mississippi – apparently encouraging voter suppression also emerged on Twitter.
That recording showed the senator saying there were some liberals “who maybe we don’t want to vote – maybe we want to make it just a little more difficult [to vote]”.
Her campaign later said the comment was a joke and the video had been “selectively altered”, the Washington Post reported.
At a recent debate, Ms Hyde-Smith gave a qualified apology to anyone she had offended, while adding that opponents had “twisted” her words “as a political weapon”.
President Donald Trump travelled to Mississippi on the eve of the vote to campaign for Ms Hyde-Smith.
“I know her, and I know she apologised, and she misspoke,” the Republican president told reporters on his way to the state.
He painted Mr Espy as a far-left ideologue who would “rather protect illegal aliens than people who live in Mississippi”, and questioned how he “fit in with Mississippi”.
Why was the election still unresolved?
After Republican Senator Thad Cochran resigned in April, a special election for Mississippi’s US Senate seat was arranged.
Under the state’s law, if no candidate wins over 50% of the votes, a runoff election must take place.
On 6 November during the mid-term elections, both Ms Hyde-Smith and Mr Espy received about 41% of the vote.