Updated

Republican Ron DeSantis will defeat Democrat Andrew Gillum in the battle to be Florida’s next governor, Fox News projects.

DeSantis, 40, an Iraq War veteran, decorated military lawyer and former Florida congressman, defeated the Tallahassee mayor by a razor thin margin Tuesday night, with the two candidates neck and neck in the heated contest for the majority of the evening.

Gillum fell short in his bid to become Florida's first African-American governor. He conceded to DeSantis, who has been an outspoken supporter of President Trump, saying he still "believes in the long run, good always wins over evil."

FULL MIDTERM RESULTS

"I still believe that," Gillum said in his concession speech.

"We could not be prouder of the way that we ran this race. We couldn't be prouder. We could not be more thankful for the support that was shown by each and every one of you. All the way along this path," Gillum said. "We let our voices be heard. We didn't shrink from the challenges. We didn't shrink from power. We spoke truth to power. And just because we didn't always come out victorious we didn't retreat. We stood up we stood strong we spoke out because we recognize that we had power."

Gillum said he called Desantis and congratulated him, but told supporters that "in spite of our congratulating him on his victory this evening nothing that we believe in is compromised."

DeSantis’ victory keeps the crucial swing state of Florida in Republican hands for the 2020 presidential election.

His victory comes after a heated campaign to succeed Republican Gov. Rick Scott, who is term-limited. Scott is running against incumbent Democratic Sen. Bill Nelson in one of the nation’s most closely watched Senate races. Fox News' Decision Desk still has projected that race as too close to call.

DeSantis, who attended Yale University and Harvard Law School, resigned his seat in the U.S. House of Representatives in September to focus solely on his gubernatorial bid. He enjoyed support from President Trump throughout his campaign. The president endorsed DeSantis in June.

DeSantis argued throughout the campaign that Florida’s relationship with the president – whether he or she agrees with his policies or not— is important for the state.

“You need to be able to work with the president,” DeSantis said last month, saying he would be “better positioned to advance Florida’s priorities” due to his “productive relationship with the administration.”

The DeSantis-Gillum campaign was among the most closely watched in the country this midterm election season. Though Gillum had a  slight edge in the polls leading up to Election Day, and support from high-profile Democrats like former President Barack Obama, Florida has not elected a Democratic governor since 1994.

MIDTERM LIVE BLOG

Racial divisions were highlighted throughout the campaign. The day after Gillum won the Democratic primary, DeSantis said Florida voters shouldn’t “monkey this up” by electing Gillum. The former GOP congressman spent weeks explaining the remark, maintaining it had nothing to do with race, but rather his belief that Gillum would hurt Florida’s economy.

In turn, Gillum was assailed over alleged ties to a radical far-left group associated with anti-Semitism and Palestinian terrorism. Additionally, his campaign cut ties with a volunteer during the final weeks of the race, after the volunteer was caught on video calling Florida a “cracker” state and saying the campaign was taking advantage of “white guilt.”

Gillum’s campaign also battled headaches over an FBI probe into possible corruption in Tallahassee during his administration. Gillum has long denied wrongdoing, and said the FBI even told him he was not a focus of the investigation. But Republicans, including Trump, made an effort to tie Gillum and his record to the federal investigation.

“In Florida there is a choice between a Harvard/Yale educated man named @RonDeSantisFL who has been a great Congressman and will be a great Governor - and a Dem who is a thief and who is Mayor of poorly run Tallahassee said to be one of the most corrupt cities in the Country!” Trump tweeted last week.

Gillum responded that Trump was “howling because he’s weak,” and tweeted that Trump was lying about him. “But as my grandmother told me -- never wrestle with a pig. You both get dirty, but the pig likes it. So ignore him and vote, Florida!”

The dispute further elevated Gillum’s national profile, while also drawing attention back to the FBI investigation. According to local reports, the FBI has been investigating potential corruption related to land deals. Last year, the FBI issued subpoenas for documents from the city related to developers.

Separate from the FBI investigation, Gillum was criticized for a 2016 interaction with an undercover FBI agent. The agent was posing as a businessman interested in investing in Tallahassee, according to local reports.

Gillum’s past actions were scrutinized by the Florida Commission on Ethics. That ethics probe recently revealed that he’d accepted tickets to the Broadway musical “Hamilton” from the undercover FBI agent in 2016.

Gillum claimed he thought the ticket came from his younger brother, and acknowledged that he “should have asked more questions.”

Fox News’ Kaitlyn Schallhorn, Alex Pappas and The Associated Press contributed to this report.