Updated 12:03 a.m. ET

Favorites of both the conservative and progressive movements scored surprising wins in Florida's gubernatorial primaries on Tuesday, setting up a competitive clash come November.

On the Democratic side in Florida, Tallahassee Mayor Andrew Gillum's victory was the most unexpected of the night, as he defeated centrist former Rep. Gwen Graham. His victory is one of the most significant progressive victories of the 2018 primary season — a surprise upset in a statewide race, to lead one of the biggest states in the country, which is one of the year's top battlegrounds.

Florida Rep. Ron DeSantis won the Republican nomination, cruising to a nearly 20 point win over establishment-backed Adam Putnam, the state's agriculture commissioner — a margin no one expected, boosted by his coveted endorsement from President Trump.

In Arizona, national Republicans got their pick in a top Senate race with Rep. Martha McSally emerging from a bitter GOP primary. She'll face Democratic Rep. Kyrsten Sinema in one of Democrats' best takeover chances during a midterm cycle where they're largely playing defense. Either way, Arizona is poised to have its first female senator next year.

Donald Trump vs. Bernie Sanders proxy battle

Both of the Florida primary wins show that the momentum in each party lies in the far right and the far left. DeSantis had been seen as a slight favorite, but no one had predicted such a blowout win over Putnam, who started the race as the clear frontrunner.

Gillum hadn't led in a single poll and was heavily outspent by several of his rivals, but was able to harness the progressive energy to beat Graham, a famed political scion in the state whose father had served as governor and senator. Sen. Bernie Sanders campaigned for Gillum and drew more than 1,000 people to a rally in Tampa earlier this month. Gillum campaigned on repealing the state's controversial Stand Your Ground law, Medicare for all and raising the minimum wage.

In a statement, Sanders said Gillum had "laid out a vision for a new course for the state of Florida and our country." Billionaire donor Tom Steyer also endorsed Gillum and spent on his behalf, and on Tuesday called his win "further proof that when Democrats put forward candidates that tell the truth and embrace a bold vision for the future, they win."

Gillum would be the first African-American governor of Florida if elected, and he becomes the second black Democratic gubernatorial nominee this year in the South, joining Georgia's Stacey Abrams.

In the GOP primary, DeSantis tied himself closely to Trump, and it paid off. In one memorable ad, DeSantis showed himself with his children, teaching them to "build the wall" with blocks and reading them the president's famous book, The Art of the Deal.

Trump held a rally in the state to help the Republican congressman and sent out plenty of tweets praising DeSantis, who's been one of his most vocal allies in Congress.

Congressman Ron DeSantis is a special person who has done an incredible job. He is running in Tuesdays Primary for Governor of Florida….Strong on Crime, Borders and wants Low Taxes. He will be a great Governor and has my full and total Endorsement! — Donald J. Trump (@realDonaldTrump) August 27, 2018

Putnam, a former congressman who was once seen as a rising star in the GOP, criticized DeSantis as nothing more than a puppet of the president and said he was out of touch with Florida-specific issues. But, as it has time and again in Republican primaries this year, that tactic fell short.

DeSantis's victory is yet another example of Trump's ability to lift candidates to victory in GOP primaries. One notable exception where Trump couldn't do that was last week in Wyoming's gubernatorial primary, where Republican megadonor Foster Friess fell short. But in other races in South Carolina, New York and more, he's shown an ability to move voters to candidates who side with him and against candidates who don't, even incumbents.

Democrats had believed that the conservative DeSantis could give them a chance to take back the governor's mansion for the first time in two decades, liking the pairing of him against the more moderate Graham. But a Gillum vs. DeSantis race would take on a new dynamic. It represents a generational shift, too — both men are only 39 years old.

Florida will also be home to one of the top Senate contests this cycle. Current Republican Gov. Rick Scott easily defeated a nominal challenger to win the GOP nomination. Now, he'll face Democratic Sen. Bill Nelson this fall in one of Republicans' best pick up opportunities.

There could be as many as a half-dozen competitive House races in Florida this fall too. One of top pick-up opportunity for Democrats is in the open 27th District, where former Health and Human Services Secretary Donna Shalala won the Democratic nomination in a district Hillary Clinton carried by 20 points in 2016. Republicans got their preferred nominee, TV anchor Maria Elvira Salazar, in the Hispanic-majority Miami district, but it's still a tough seat for the GOP to defend.

EMILY's List-backed Democrat Debbie Mucarsel-Powell won the primary in the neighboring 26th District to take on Republican Rep. Carlos Curbelo, in a district Clinton carried by 16 points.

The wins by Shalala and Mucarsel-Powell continue a trend of Democratic women showing strength in primaries this cycle across the country.

Battleground Arizona

In Arizona, McSally — the first female fighter pilot in U.S. history to fly in combat — emerged from a nasty primary to win the Republican nomination as she tries to succeed retiring GOP Sen. Jeff Flake in one of the year's top Senate races.

McSally easily defeated two far-right candidates whom national Republicans feared would cost them the seat if nominated — former state Sen. Kelli Ward, who unsuccessfully challenged Sen. John McCain in 2016, and former Maricopa County Sheriff Joe Arpaio, who was pardoned by Trump last year after he was convicted of criminal contempt for his hardline efforts in detaining immigrants.

McSally, who had more of a moderate record in the House, had to move to the right in order to win the primary though, most notably on immigration, which Democrats argue will hurt her in a state with a growing Hispanic population. She had also denounced Trump in the run-up to the 2016 election, but now cozied up to him.

McSally has already begun to draw a stark contrast between herself and Sinema, a former Green Party anti-war activist who's now a Blue Dog Democrat. The race is a must-win for Democrats if they want to have any hope — albeit slim — of taking back the Senate.

"This is how I see this campaign. It's a choice between a doer and a talker ... between a patriot and a protester ... between a career fighter pilot and a career politician ... between proven grit and Hollywood glitz," McSally said in her remarks. "There is nothing wrong with Hollywood glitz. I am as impressed as anyone that my opponent owns over 100 pairs of shoes. I, on the other hand, flew over 100 combat missions for our country."

Meanwhile, Democratic Senate Majority PAC said in a statement that "McSally spent the primary pandering to her conservative base and abandoning her prior political beliefs ... she will not be able to suddenly walk it all back and pretend to be moderate Martha again. Martha McSally's serial flip-flopping shows that she puts her career in politics first and the needs of Arizona second, and that Arizona voters cannot trust a single thing she says."

In the Oklahoma gubernatorial runoff, mortgage company executive Kevin Stitt defeated former Oklahoma City Mayor Mick Cornett to win the GOP nomination. Stitt, a political newcomer, campaigned as the more conservative outsider candidate, putting millions of his own money into the race. That strategy won out over Cornett's emphasis on his political experience. Stitt will now face Democratic nominee Drew Edmondson, the state's former attorney general, for the right to succeed outgoing Republican Gov. Mary Fallin.

Copyright 2020 NPR. To see more, visit https://www.npr.org.