President Trump’s favored candidate, GOP Rep. Ron DeSantis, defeated state Agriculture Commissioner Adam Putnam in Florida’s Republican gubernatorial primary on Tuesday after riding the wave of the president's enthusiastic endorsement to victory.

Meanwhile, the Bernie Sanders-backed Tallahassee Mayor Andrew Gillum pulled off a major upset in defeating a half a dozen rivals, including former Rep. Gwen Graham, in the Democratic primary.

DeSantis and Gillum will face each other in November's general election. If he triumphs, Gillum would be the state's first black governor.

During a celebration event in Orlando, DeSantis thanked the president for "viewing me as somebody who could be a great leader for Florida."

"Our victory is a good victory, anyways," DeSantis said, complimenting Putnam on a hard-fought race. "But man, to beat someone of his caliber is a big, big deal."

The president repeatedly had implored voters to support DeSantis over Putnam. Trump offered his congratulations on Twitter.

"Such a fantastic win for Ron DeSantis and the people of the Great State of Florida," Trump tweeted. "Ron will be a fantastic Governor. On to November!"

Appearing on the "Ingraham Angle" later, DeSantis downplayed the notion that his win was due to the president's backing, and touted his record on combatting environmental problems, illegal immigration, and education reform.

"We've been talking about these key issues time and time again and we're going to continue to do that and spread the message far and wide," he said.

Gillum, Tallahassee’s progressive mayor backed by the Democratic-socialist Sanders, shocked observers with his win, as Graham, the daughter of former Florida Governor and Sen. Bob Graham, led in pre-election polls.

"I'm truly honored to represent people across the state as the Democratic nominee -- and I promise to stand up for everyday Floridians and the issues that matter most," Gillum tweeted after his win.

Alexandria Ocasio-Cortez, the Democratic socialist star running for New York's 14th district, praised Gillum for staking out liberal positions by supporting Medicare for all, legalizing marijuana and abolishing Immigration and Customs Enforcement (ICE).

“The progressive movement is transforming the country - and he proved that again tonight,” Ocasio-Cortez tweeted.

In the state's closely-watched Senate contest, Florida Republican Gov. Rick Scott on Tuesday easily won the GOP nomination. He faced a challenge from perennial candidate Roque De La Fuente.

"Congratulations to Governor Rick Scott of Florida on his conclusive Republican Primary Win," Trump, who encouraged Scott to run, tweeted. "He will be a great Senator!"

Scott, who is term-limited as governor, is set to face incumbent Democratic Sen. Bill Nelson in what surely will be one of the most closely watched Senate races in November. Nelson ran unopposed in the Democratic primary.

But much of the attention in the run-up to Tuesday's vote had been on the contentious Republican gubernatorial primary between DeSantis and Putnam.

During a Fox News-sponsored debate in June, DeSantis played up Trump’s backing of his campaign, expressing doubt that Putnam adequately supported Trump. “I am proud to have the endorsement of President Trump in this race,” DeSantis said.

DeSantis, 39, is an Iraq War veteran and decorated military lawyer who has served in the U.S. House since 2013. He is a graduate of Yale University and Harvard Law School.

Putnam, 44, also played up his support for Trump, but emphasized, “I am focused on Florida.”

As for the Senate race, Republicans are hoping Scott could flip the seat in a battle with Nelson, one of the Democratic Party’s most vulnerable incumbents.

Trump narrowly defeated Democrat Hillary Clinton in Florida in the 2016 presidential race by less than 2 percentage points.

It was a good night for incumbents in House races in Florida, as Republican Carlos Curbelo and Democrat Stephanie Murphy were among those who beat back primary challengers.

National Democrats have eyed Curbelo's 26th congressional district as a potential pickup target, in large part because it voted heavily for Clinton in the 2016 presidential election. But with almost all precincts reporting, approximately 2,500 more people had turned out to vote in the GOP primary than in the Democratic primary.

Curbelo garnered 84 percent of the vote against primary opponent Souraya Faas, who described Russian President Vladimir Putin and Syrian leader Bashar al-Assad as "heroes" and claimed chemical attacks in Syria's civil war were "staged."

In November, Curbelo will face Debbie Mucarsel-Powell, a former associate dean at the Florida International University Medical School and Democratic candidate for state Senate.

Murphy, who unseated GOP incumbent John Mica in 2016, easily defeated a primary challenge in the 7th District from Chardo Richardson, who was backed by Ocasio-Cortez. She will face Florida state Rep. Mike Miller in November's general election.

Fox News’ Samuel Chamberlain, Kaitlyn Schallhorn, Mike Arroyo and The Associated Press contributed to this report.