Phoenix (CNN) Rep. Martha McSally will win the Republican Senate nomination in Arizona, CNN projects, fending off a challenge from two hard-line conservatives and providing ambitious moderates in the GOP ranks a playbook to thrive in the Donald Trump era.

McSally defeated former state Sen. Kelli Ward and former Maricopa County Sheriff Joe Arpaio in a race that was overshadowed in recent days by the death of Arizona's Sen. John McCain.

She'll face Democratic Rep. Kyrsten Sinema in a marquee match-up for the seat, which became vacant when Arizona's other Republican senator and intra-party Trump critic, Jeff Flake, announced he would retire rather than likely lose a primary over his criticism of the President.

McSally -- who sharply criticized Trump when the "Access Hollywood" tape that captured him making lewd remarks about women was released in 2016 -- closely aligned herself with him on issues like immigration during her Senate primary run. Her win in the last competitive primary on 2018's Senate battleground map is a major relief for Republicans who have watched Sinema spend millions of dollars on TV ads branding herself as a centrist who would "end the partisan nonsense and protect Arizonans" on issues like health care while Republicans went through a grueling primary.

Trump didn't endorse in the race, but he gave McSally a shout-out at a recent event at Fort Drum in New York. He noted that she is "not only an Air Force veteran, but the first woman ever to fly a fighter jet in combat in US history."

"And I got to know her very well, and she is terrific: Congresswoman Martha McSally," Trump said.

In the race's final days, both Ward and Arpaio set off controversy related to their handling of McCain's illness and death. Ward suggested on Facebook that a statement released Friday announcing McCain was ending medical treatment for brain cancer was timed to damage her campaign. Then, on Monday, she tweeted -- in what she later denied was a reference to McCain's illness -- that "Political correctness is like a cancer!" Arpaio, meanwhile, complained that he offered McCain's family condolences only to find that Cindy McCain had blocked him on Twitter.

Add CNN's 2018 elections calendar Stay up to date on key election dates and other events, such as town halls and debates, as they get added throughout the year. Subscribe on your Google or Apple calendar.

Progressive Gillum wins a stunner in Florida

Tallahassee Mayor Andrew Gillum will win the Democratic nomination for governor of Florida, CNN projects, scoring a major victory for the party's progressive wing while taking another step toward becoming the state's first black chief executive.

Backed by Vermont's independent Sen. Bernie Sanders and a coalition of progressive groups, Gillum upset former Rep. Gwen Graham, who had led in the polls for most of the campaign. He led a field of five competitive candidates in which he was the only non-millionaire -- and only supporter of "Medicare for all" single-payer health care. Gillum is the first black candidate to win a major-party gubernatorial nomination in Florida.

His victory sets up Florida, the biggest swing state in presidential elections, as a major test of the political atmosphere this fall. Gillum will face Rep. Ron DeSantis, a Trump-endorsed Republican, in a race that pits two 39-year-olds, who in many ways mirror their parties' national moods, against each other.

DeSantis defeated Adam Putnam, the state agriculture commissioner, CNN projects. His win was expected -- but Putnam had entered the race as the establishment favorite and raised more money than DeSantis. DeSantis' victory proved the power of Trump's endorsement in swaying GOP primary voters.

Gillum's victory, though, came as a stunner in a wide-open contest. Democrats in the race, including billionaire Jeff Greene and wealthy former Miami Beach Mayor Philip Levine, spent more than $100 million for the chance to wrest back control of the governor's mansion, which has been in Republican hands for two decades. Gillum got a late boost when liberal megadonors Tom Steyer and George Soros led a group that donated $650,000 to his affiliated political action committee.

The governor's race is one of two major statewide contests in Florida in November's midterm elections.

In the other, CNN projects that Florida Gov. Rick Scott will win the Republican Senate primary to face incumbent Democratic Sen. Bill Nelson for a seat Democrats must hold if they hope to have a shot at the Senate majority.

Arizona, Oklahoma choose gubernatorial nominees

In Arizona, Republican Gov. Doug Ducey is up for re-election and will face Arizona State University education professor David Garcia, who defeated state Sen. Steve Farley and Kelly Fryer, the CEO of the YWCA Southern Arizona, for the Democratic nomination in a traditionally red state that has shifted to the left in recent years: Hillary Clinton lost there by just 4 percentage points.

The primary comes days before Ducey faces a major decision: who to appoint to fill McCain's seat. He'll have to choose between a Trump-like Republican and someone in the McCain mold -- or could try to bridge the gap, potentially with a placeholder pick.

In Oklahoma, Democratic state Attorney General Drew Edmondson will face Republican Tulsa businessman Kevin Stitt, who CNN projects will defeat Oklahoma City Mayor Mick Cornett for the seat being vacated by unpopular, term-limited Gov. Mary Fallin.

Arizona and Florida also each have several primaries for House seats that are expected to be competitive in November's midterm elections.

Trump dominant in Arizona Senate primary

The Arizona Senate GOP primary underscored how the Republican Party in Arizona has shifted from one where McCain, the 2008 GOP presidential nominee, reigned supreme to one where Trump is the dominant force.

All three GOP candidates cozied up to the President. McSally, in particular, dropped her 2016 campaign criticism of Trump and aligned herself closely with the President.

Arpaio was competing for the same group of die-hard conservative voters as Ward, meaning that his presence in the race has cut directly into her support and undercut conservatives' hopes of beating McSally.

National Republicans see the Arizona US Senate race as crucial to keeping their majority, and think McSally is the only candidate that gives them a chance to win the race. Until recent weeks, they'd been frustrated she had not put the primary away.

But McSally found her footing with an onslaught of TV ads late in the race.

She aired an ad featuring Trump calling her the "real deal." She withdrew her co-sponsorship of a bill that offered "Dreamers" a path to citizenship, and she mimicked Trump's attacks on "chain migration." She became a fixture on Fox News, where she aligned herself with Trump and heaped praise on the President.

And she cast Ward -- who'd launched her campaign as a strident critic of Flake and McCain, a Trump opponent, with the backing of then-White House chief strategist Steve Bannon -- as a Trump critic.

"McSally did a masterful job capitalizing on Ward's 'phonyisms,' " said Robert Graham, a former Arizona Republican Party chairman who is a Trump ally. "The religious right freaked and abandoned her and the immigration people consider her soft."

An anti-Ward super PAC spent more than $4 million on at times misleading ads that cast her as weak on immigration enforcement and opposing Trump's calls for increased military spending.

McSally's campaign, meanwhile, aired an ad asserting that Ward "doesn't support President Trump" on immigration. It highlighted Ward's opposition to a Trump-backed bill that Ward labeled "amnesty."

Another key moment came in a late-July editorial board meeting at The Arizona Republic -- the only time McSally and Ward would debate, with Arpaio declining the invitation -- on the topic of abortion. Both said they want Roe v. Wade repealed, but Ward called for a "more incremental" approach, including a ban on abortions after 24 weeks, while McSally said she favors banning abortion in all cases except rape, incest and when the woman's life is in jeopardy.

Ward also said abortion is debated "in a fashion that was designed to raise money for people on both sides of the issue."

The comments alienated anti-abortion activists who were a key part of the conservative constituency a McSally challenger would have needed.

Then, late in the campaign, Ward courted controversy when she invited Mike Cernovich -- a far-right commentator who promoted the infamous "Pizzagate" conspiracy theory -- on her bus tour, and then told NBC News that "attaching those things to me is ridiculous."

Explaining her decision to invite Cernovich, Ward said: "We need to have a hook to get you guys interested in seeing the bus tour."

Ward apologized Monday for a Facebook comment a few days previously suggesting an announcement by McCain's family that he would end his cancer treatment was designed to hurt her campaign, saying her comment had been misinterpreted.

Arpaio, meanwhile, watched his campaign descend into chaos. The Federal Election Commission laid out a host of problems with his first-quarter campaign finance report in a letter to his campaign. And longtime consultant Chad Willems, who until recently was Arpaio's campaign manager, was receiving the vast majority of the $1.3 million raised for the campaign. Arpaio's campaign ended in a fizzle, while Ward attracted headlines as the anti-establishment candidate.

"McSally proved to voters for months that she has the ability to laser-focus in on Sinema's weaknesses in a way that highlights her own strengths, even while facing competitors in a primary," said Brian Anderson, an Arizona GOP strategist and former aide to Ducey.

"Kelli Ward continued to remind everyone," Anderson said, "that she's a ticking time bomb who can't talk her way through a question about Pizzagate -- let alone face an opponent like Sinema."