WASHINGTON – Republican Sen. Cindy Hyde-Smith fended off a challenge from Democrat Mike Espy Tuesday in a closely watched Senate runoff election marked by racial tensions.

She becomes the first woman from Mississippi elected to Congress. The Associated Press called the race for Hyde-Smith just before 10:30 pm EST.

President Donald Trump, who campaigned for Hyde-Smith in Mississippi Monday, applauded Hyde-Smith on her victory.

"Congratulations to Senator Cindy Hyde-Smith on your big WIN in the Great State of Mississippi,'' he tweeted late Tuesday. "We are all very proud of you!"

Hyde-Smith was appointed by Republican Gov. Phil Bryant to fill the seat of longtime GOP Sen. Thad Cochran, who retired in April because of failing health. Hyde-Smith, a former state agriculture commissioner and state senator, will complete the two years remaining of Cochran’s term.

The contest was the last Senate race of 2018 and will give Republicans a 53-47 advantage next session. As of Wednesday afternoon, unofficial results showed Hyde-Smith leading 53.8 percent to 46.1 percent.

"You’ve handed me a victory. I’m not going to let you down," Hyde-Smith told supporters in Jackson. "I am going to Washington, D.C. first thing in the morning."

Hyde-Smith, 59, will be among a record number of women, mostly Democrats, elected to Congress this year and part of the record number of women – 24 – to serve in the Senate in the upcoming 116th session. Of those, 17 are Democrats and seven are Republican.

The new number tops the record of 23 women now serving in the Senate.

“Mississippi was one of the last two states to have never elected a woman to Congress," said Debbie Walsh, director of the Center for American Women and Politics at Rutgers University. “While Cindy Hyde-Smith got Mississippi out of that undistinguished club when she was appointed, there still had never been a woman elected, so this is another milestone for the state of Mississippi."

Vermont is now the only state to have never elected a woman to Congress.

Despite the historic moment, much of the national attention on the Mississippi race in recent weeks has focused on Hyde-Smith’s controversial “public hanging” remark that sparked an uproar in a state with a troubled history of discrimination and lynching.

Espy, her opponent, is African-American.

Espy, who launched his long-shot campaign in March, traveled the country to get support and raise money for his campaign. Civil rights organizations and Democratic groups ramped up get-out-the-vote efforts in the state to rally supporters.

"This is not a loss. It's a movement," Espy told a crowd Tuesday in Jackson. "And this movement is not going to end."

If Espy had won, he would have been the first African-American to represent Mississippi in the Senate since Reconstruction.

The Mississippi Senate race should have been an easy GOP win in the ruby-red state, but it took many twists and turns with Trump dropping in at the 11th hour to help Hyde-Smith’s faltering campaign.

“I don't want to take my chances" of her losing, Trump said at one of two rallies for Hyde-Smith in Mississippi Monday.

It was unusual for Republicans to have to battle for the seat. It’s been decades since a Democrat won a U.S. Senate seat in Mississippi.

Trump won the conservative state in 2016 and five of the six members of the state’s congressional delegation are Republicans.

“It should have been a slam dunk," said John Bruce, chair of the Political Science Department at the University of Mississippi. “We’re here because of the president and the national mood. And we’re here because Cindy Hyde-Smith has run a bad campaign. She has tripped over herself more than once."

Hyde-Smith had come under fire for remarks considered racially insensitive. In a video at a Nov. 2 event, Hyde-Smith said of a supporter, "If he invited me to a public hanging, I'd be on the front row."

Mississippi has a history of lynching blacks. Hyde-Smith has since apologized “for anyone who was offended,” but blasted her opponents for trying to twist her comments.

Trump noted her apology and defended her saying Monday "her heart is good."

Hyde-Smith, who has kept a low profile in her seven months in the Senate, has been an avid supporter of Trump and his policies. She voted for several measures backed by Trump, including the confirmation of Judge Brett Kavanaugh to the U.S. Supreme Court.

She campaigned on supporting Trump tax cuts, a stronger border patrol and funding for a border wall.

"This victory is about conservative values,'' Hyde-Smith said late Tuesday.

Outsiders stepped in

Trump, in turn, came to her aid, stumping for Hyde-Smith in Mississippi in October and returning on the eve of Tuesday’s runoff.

Vice President Mike Pence and Sen. Joni Ernst, R-Iowa, among others, also campaigned for Hyde-Smith.

Espy, 64, former congressman and U.S. secretary of agriculture during the Clinton administration, also had high-profile backers campaign for him in Mississippi, including possible 2020 Democratic presidential contenders Sen. Kamala Harris of California and Sen. Cory Booker of New Jersey.

Beyond the visits, both campaigns and their allies spent millions on ads in recent weeks leading up to the special election.

Bruce said there have rarely been competitive special elections in Mississippi and that Republicans were nervous because they were “in unchartered territory.”

“This is kind of a novel thing," he said.

The national NAACP, which along with other civil rights groups had blasted Hyde-Smith for her remarks, said it will continue to launch get-out-to-vote efforts in Mississippi and other states.

"While we are hopeful that the Senator-elect will prove herself worthy of her new office, this election demonstrates the need to continue broadening the tent of civic and democratic participation in our nation,'' the organization said in a statement.

Mississippi in the spotlight again

It’s not the first time a Mississippi Senate race has drawn national attention.

The race for this same seat was also in the national spotlight in 2014 when Cochran had to fend off a runoff challenge from state Sen. Chris McDaniel, a tea party favorite.

Black voters are credited with helping Cochran pull off that win, but the senator was criticized by some fellow Republicans for courting them.

Contributing: Luke Ramseth, Justin Mitchell, Bracey Harris, Clarion-Ledger

More:Sen. Cindy Hyde-Smith attended segregational school, praised Confederates in legislation: reports

More:President Trump holds Tupelo rally a day before Mississippi Senate runoff

More:Mississippi plants seeds to elect state's first woman to Congress