President Trump late Tuesday congratulated incumbent Republican Sen. Cindy Hyde-Smith for handily defeating an insurgent challenge by Democrat Mike Espy in Mississippi's contentious special election runoff to become the first woman ever elected to Congress from the state.

The GOP victory gives Republicans a net gain of two Senate seats in the midterm elections and a 53-47 advantage in the upper chamber, a margin that could prove critical in contentious confirmation battles to come.

Hyde-Smith, 59, is an ardent supporter of Trump who was appointed earlier this year by Mississippi's governor to fill retiring Sen. Thad Cochran's seat. She will finish out the remaining two years of Cochran's term in the deep-red state that went for Trump by nearly 20 percentage points in the 2016 presidential election.

"Congratulations to Senator Cindy Hyde-Smith on your big WIN in the great state of Mississippi. We are all very proud of you!” Trump tweeted.

With 95 percent of precincts reporting, Hyde-Smith had 446,927 votes to Espy's 374,880 -- a commanding margin of 54.4 percent to 45.6 percent, according to state election officials. The race marks the final midterm contest of 2018.

“I want everybody to know, no matter who you voted for today, I’m gonna always represent every Mississippian,” Hyde-Smith said at her victory party late Monday night. "Being on that MAGA-wagon, the Make American Great Again bus, we have bonded, we have persevered, we have gotten through things, we were successful today."

Hyde-Smith's win gives Republicans more leeway to ensure the confirmation of Trump's federal judicial and Cabinet nominees that require Senate approval and strengthens the party's chances of holding the majority in 2020.

"She has my prayers as she goes to Washington to unite a very divided Mississippi," Espy said in his concession speech.

“Cindy Hyde-Smith has been a strong conservative voice since joining the Senate, so it should come as no surprise that she was elected by Mississippians to represent them in Washington,” National Republican Senatorial Committee (NRSC) Chairman Cory Gardner said in a statement. “Senator Hyde-Smith won tonight because she has a trusted record of fighting for Mississippi, and we are happy she will be returning to the United States Senate.”

On Nov. 6, Hyde-Smith prevailed in a four-way race that included firebrand Republican Sen. Chris McDaniel -- but she was unable to secure more than 50 percent of the vote amid heavy turnout, owing to McDaniel's strong showing. The Nov. 6 election -- which saw nearly half of registered voters in Mississippi cast ballots in the Senate race-- triggered Tuesday's runoff.

McDaniel sharply criticized Hyde-Smith throughout the campaign for being insufficiently supportive of the president's agenda, and some analysts suggested he may have dampened enthusiasm among conservatives for her candidacy.

“There has been a lot of work done to make sure that McDaniel’s supporters will turn out, but the hardest part about runoff elections is getting people to turn out,” Jennifer Duffy, the senior editor for the Cook Political Report, told Fox News. “If they don’t turn out, McDaniel will be seen as the spoiler because if it wasn’t for him, there would not have been a runoff in the first place.”

AT ROUNDTABLE WITH HYDE-SMITH, TRUMP CRITICIZES 'GRABBER' MIGRANTS WHO USE KIDS AS HUMAN SHIELDS

McDaniel offered only a lukewarm endorsement for Hyde-Smith after his defeat earlier in the month, saying, "I don't believe she's the conservative for this state." He also told his supporters that "President Trump wants us to unite, and we will unite" to back her.

Espy “cannot be allowed to win this seat,” McDaniel said shortly after conceding the race, according to Mississippi Today. “President Trump wants us to unite, and we will unite. We will back Cindy Hyde-Smith.”

The 64-year-old Espy, who was vying to become Mississippi's first black senator since Reconstruction, had previously served in Congress and in former President Bill Clinton's administration.

Mississippi last elected a Democrat to the U.S. Senate in 1982, but Espy was trying for the same kind of longshot win that fellow Democrat Doug Jones had nearly a year ago in neighboring Alabama, another conservative Deep South state where Republicans hold most statewide offices.

His campaign gained a second wind amid a flurry of damaging reports and missteps that inundated Hyde-Smith's campaign in recent days. Mississippi's past of racist violence became a dominant theme in the race after a video showed Hyde-Smith praising a supporter in early November by saying, "If he invited me to a public hanging, I'd be on the front row." She said it was "an exaggerated expression of regard."

As voters headed to the polls, nooses were found outside Mississippi State Capitol, along with signs explaining that they were placed there by protesters who wanted to raise awareness about the state's history of racially motivated lynchings. Some media figures inaccurately blamed Hyde-Smith supporters for placing the nooses.

"So many things are taken out of context," said Elizabeth Gallinghouse, 84, from Diamondhead, Mississippi. "The fact that she toured Jefferson Davis's house. You or I could have done the same thing. They said, 'Put this cap on. Hold this gun.' It was a fun time. She wasn't trying to send any messages."

MAJOR LEAGUE BASEBALL BECOMES LATEST BIG MONEY DONOR TO DEMAND MONEY BACK FROM HYDE-SMITH

More than a week after the video's release, Hyde-Smith apologized at a televised debate to "anyone that was offended by my comments," but also said the remark was used as a "weapon" against her. Espy responded: "I don't know what's in your heart, but I know what came out of your mouth."

Some corporate donors, including Walmart and Major League Baseball, requested refunds on their campaign contributions to Hyde-Smith after the videos surfaced.

Hyde-Smith was seen in another video talking about making voting difficult for "liberal folks," and a photo circulated showing her wearing a replica Confederate military hat during a 2014 visit to Beauvoir, a beachside museum in Biloxi, Mississippi, that was the last home of Confederate president Jefferson Davis.

Critics said Hyde-Smith's comments and Confederate regalia showed callous indifference in a state with a 38-percent black population, and some corporate donors, including Walmart, requested refunds on their campaign contributions to her.

However, Espy has had his own negative press in the run-up to the runoff. In particular, the Hyde-Smith campaign hammered Espy for his $750,000 lobbying contract in 2011 with the Cocoa and Coffee Board of the Ivory Coast. She noted that the country's ex-president, Laurent Gbagbo, is being tried in the International Criminal Court for crimes against humanity.

Espy, who is an attorney, said: "I found out later that this guy, the president, was a really bad guy. I resigned the contract."

"She stood up to the Democrat smear machine." — President Trump

Espy resigned as President Bill Clinton's agriculture secretary in 1994 amid a special-counsel investigation that accused him of improperly accepting gifts. He was tried and acquitted on 30 corruption charges, but the Mississippi Republican Party ran an ad this year that called Espy "too corrupt for the Clintons" and "too liberal for Mississippi."

Espy said he refused to accept offers of plea deals because, "I was so not guilty, I was innocent."

The significance of the race was not lost on President Trump or top Republicans, who headlined two major rallies Monday night for Hyde-Smith in Mississippi to boost turnout.

"If you like [Supreme Court Justice Brett] Kavanuagh, there's more coming," South Carolina Republican Sen. Lindsey Graham told the crowd in Tupelo, Miss. "Let's win tomorrow."

"She stood up to the Democrat smear machine," Trump said, referring to Hyde-Smith's support for Kavanaugh amid a series of uncorroborated and lurid sexual misconduct allegations.

He added: "Your vote on Tuesday will decide whether we build on our extraordinary achievements, or whether we empower the radical Democrats to obstruct our progress."

Hyde-Smith, who has made the Trump rallies a highlight of her runoff campaign, told the crowd in Tupelo: "I worked very, very hard for you. I have stood up for you and you know I will continue to stand up for the conservative values of Mississippi."

Fox News' Peter Doocy, Andrew O'Reilly and The Associated Press contributed to this report.