Republican Sen. Cindy Hyde-Smith has defeated Democrat Mike Espy in Tuesday night's special Senate election in Mississippi, a contest tainted by race-related controversies, NBC News projects.

With 98 percent of votes being reported, Hyde-Smith had 53.0 percent, or 473,109 votes, to 46.1 percent, or 404,640 votes, for Espy.

The Republican incumbent's single-digit victory in the deep-red state was not regarded by analysts as particularly impressive, while Espy appears to have outperformed Hillary Clinton in 2016 and Barack Obama when he ran for president both times.

Hyde-Smith, who becomes the first woman elected to Congress from Mississippi, will serve out the remaining two years of former GOP Sen. Thad Cochran's term, whom she was appointed to replace earlier this year after he resigned.

With her win in the final contest of the midterm cycle, Republicans will start the new Congress in January with a 53-47 majority in the Senate. The GOP expanded its Senate majority in the midterm elections despite Democrats making a net gain of at least 39 seats in the House, with one race left to be called.

"This is just an unbelievable night," Hyde-Smith told supporters Tuesday night at a post-election event. "This has been an unbelievable campaign. God above is the reason we're here, and I'm going to give him glory every single day."

She thanked President Donald Trump for his support and promised to represent "every Mississippian" regardless of whom they voted for. "I'm going to do my very best to make you proud," she said.

In a statement, Espy said "tonight is the beginning, not the end."

"When this many people show up, stand up, and speak up, it is not a loss," he said. "It is a moment. It is a movement. And we are not going to stop moving our state forward just because of one election. I look forward to finding new ways to do just that.”

Espy told supporters following the loss that Hyde-Smith "has my prayers as she goes to Washington to unite a very divided Mississippi."

Hyde-Smith and Espy, an ex-congressman who served as agriculture secretary under former President Bill Clinton, went to a runoff after neither received more than 50 percent of the vote on Election Day, Nov. 6. In that three-way election, GOP state Sen. Chris McDaniel, who ran to Hyde-Smith's right, picked up more than 16 percent of the vote.

The Hyde-Smith and Espy runoff was marred by a number of race-related controversies in its home stretch. Most prominently, footage of a remark Hyde-Smith made earlier this month about her willingness to attend a "public hanging" drew national attention.

Hyde-Smith insisted comment was not intended to have any racial connotation, but many interpreted it as such in a state where lynchings were once frequent and racial tensions still run deep.

In a debate last week, Hyde-Smith apologized to anyone who was offended, but added that her words were being "twisted" to use against her. Espy accused Hyde-Smith of having given the state "another black eye."

On Monday, Trump held two rallies in the state to boost Hyde-Smith's candidacy. At a roundtable event in Gulfport, Trump said he heard Hyde-Smith apologize for the public hanging remark "loud and clear," adding that he knows "her heart is good."

At an earlier rally, Trump blasted Espy as "far-left," asking "how does he fit in with Mississippi?"

Soon after Hyde-Smith was projected as the winner, Trump congratulated her in a tweet.

Congratulations to Senator Cindy Hyde-Smith on your big WIN in the Great State of Mississippi. We are all very proud of you! — Donald J. Trump (@realDonaldTrump) November 28, 2018

The controversy over Hyde-Smith's public hanging comment was just the first in the run-up to the vote. In the days after that remark went viral, additional footage was published of Hyde-Smith saying it might be a "great idea" to make it harder for some people to vote, to which her campaign responded that she was "obviously" joking.

Soon, publications began unearthing more troubling news items for Hyde-Smith. The Jackson Free-Press reported that Hyde-Smith attended a private white "segregation academy," while having sent her daughter to one years later as well. It was also reported Hyde-Smith, as a state senator, pushed for a resolution praising a Confederate soldier's efforts to "defend his homeland," while photos showed her posing with Confederate artifacts.

As a result of the controversies, prominent businesses like Walmart and Major League Baseball asked for their donations to Hyde-Smith's campaign to be returned.

In the last few weeks of her campaign, Hyde-Smith held few events and generally avoided speaking with the press.

Espy faced an uphill climb in a state that Trump won by 18 points in 2016, remains popular and where Hyde-Smith and McDaniel combined to win about 58 percent of the vote earlier this month. He also faced some controversy of his own, as Republicans highlighted his past work as a lobbyist and for having been indicted in the 1990s on corruption charges he was later acquitted of. That investigation led to his resignation as agriculture secretary.