Following the same blueprint that won President Donald Trump the state in 2016, former Rep. Ron DeSantis defeated Democrat Andrew Gillum in a similar upset on Tuesday.

In a victory speech, DeSantis told supporters that he had prevailed even as "the political media class seemed eager to write our obituary."

"As governor, I’ll make sure that Florida remains a low-tax state," he said.

Gillum told supporters that he had called DeSantis to concede.

"We recognize that we didn't win it tonight, we didn't win this transaction," he said. "But I want y'all to know that is just it, a transaction. That what we believe in still holds true today."

The governor’s race was among the most closely followed contests of the midterms, with both Trump and national Democrats heavily invested in the outcome.

Supporters of U.S. Senate candidate Rick Scott react to news of Republican gubernatorial candidate Ron DeSantis winning his election at Scott's midterm election night party in Naples, Florida, on Nov. 6, 2018. Joe Skipper / Reuters

Each candidate seemed to capture the zeitgeist of their party in 2018, presenting a stark choice for Florida voters that could offer a preview of the next presidential matchup.

Gillum, who backed single-payer health care and impeaching Trump, won his primary in an upset over a more conventional Democrat, Gwen Graham. Major Democratic donors like Tom Steyer backed his campaign early on, hoping to prove that a candidate with populist progressive views could win by boosting turnout among young and nonwhite voters to new heights rather than by reassuring moderate swing voters.

Republicans had held the governor’s seat since the 1998 midterms, repelling a string of relatively centrist Democrats along the way.

DeSantis, who resigned his House seat to run for governor, sought to mimic Trump's appeal in every way. He was a regular fixture on Fox News, the president's favorite source for information and comfort, and earned Trump's endorsement in the primaries and his support at campaign rallies in the general election. In one of the most memorable ads of the cycle, DeSantis was shown teaching his young children how to say Trump slogans like "Build The Wall" and "Make America Great Again."

His strategy appeared to work, helping counter Gillum's turnout surge with one of his own among voters still loyal to the president's message.

Exit polls showed 92 percent of Trump supporters and 85 percent of conservatives backed DeSantis on Tuesday.

The general election was notable for its direct clashes over race. Setting the tone early on, DeSantis said in a Fox News that Gillum would "monkey this up" if elected, which critics immediately denounced as a racist dog whistle.

DeSantis denied the charge, but was dogged by follow-up reports on his association with far right figures and his refusal to return money from a donor who used the n-word to deride former President Barack Obama. A white supremacist group contacted Florida voters with robo-calls in which an actor performed a racist impression of Gillum, which the DeSantis campaign condemned. In a debate moment that went viral, Gillum said: "I'm not calling Mr. DeSantis a racist, I'm simply saying the racists believe he’s a racist."

Gillum faced his own vulnerabilities. The FBI is investigating corruption in Tallahassee and while there's no sign that Gillum is a target of the probe himself, he accepted free tickets to the musical Hamilton from an undercover agent and his public explanation was undercut by text messages that emerged during the race. DeSantis warned Gillum might be "impeached" if elected while Trump falsely asserted that Gillum was a "thief" with no evidence.

In yet another echo of the 2016 contest, DeSantis supporters chanted "lock him up!" at a rally ahead of the election.