LOS ANGELES – Republicans and Democrats alike appear to have escaped calamity in a crucial day of coast-to-coast primary battles as they fight to shape the political battlefield for the fall. There was an especially big sigh of relief from Republicans on Wednesday after the party avoided being entirely shut out of California’s November election of a new governor.

Republicans had feared that Democrats would win both of the governor’s spots in California’s unique top-two primary system. With no one to support at the top of the state ticket, the concern was that Republican voters would sit the election out, giving Democrats a big advantage in House races across the state that could help swing control of Congress.

Carolyn Peisaner, center, joins other supporters of Rep. Dana Rohrabacher as they sing with the congressman at his headquarters while awaiting results for the primary in California’s 48th congressional district in Costa Mesa, Calif., on Tuesday. The Republican successfully fended off a challenge from the right.

There was less Democratic talk of a November “blue wave” on Wednesday. And President Trump, crediting “the Trump impact,” said there might be “a big Red Wave” instead. But that seemed to be more of a typical presidential boast than a realistic analysis of the California results.

While some Golden State contests remained too close to call Wednesday, Republicans managed to get business executive John Cox on the November ballot for governor. Lt. Gov. Gavin Newson, a Democrat, easily captured the top spot to succeed term-limited Jerry Brown in the deeply Democratic state’s top office. There will be no Republican candidate in the other big statewide race, for U.S. Senate.

Democrats were fighting to avoid their own calamity, in California’s many competitive House districts, and appeared to have largely succeeded. The concern in their case was that so many candidates would divide the Democratic vote and let Republicans take the top two spots in some House races. After more votes were counted on Wednesday, the Democrats appeared to have avoided being shut out in nearly all of the state’s battleground contests.

Nationwide, Tuesday night was a big night for women, as female candidates for governor advanced, including Democrat Michelle Lujan Grisham in New Mexico and Republican Kristi Noem in South Dakota. Female Republican governors in Alabama and Iowa will try for their first full terms after succeeding men who resigned.

California’s Sen. Dianne Feinstein also fared well, and will face only a fellow Democrat in November.

Still, Trump was ready to celebrate.

“Many more Republican voters showed up yesterday than the Fake News thought possible,” Trump tweeted.

Democratic Lt. Gov. Gavin Newsom waves with his wife, Jennifer Siebel Newsom, after speaking at his gubernatorial campaign’s primary night watch party in San Francisco on Tuesday.

California’s handful of competitive House races – more than a half dozen Republican-held seats may be in play – has made it hotly contested territory in the fight over control of the House, drawing big money and the spotlight on the biggest primary night of midterms. Democrats need to pick up 23 seats nationwide to retake the House.

Much of Tuesday’s drama focused on women, including former federal prosecutor and Navy pilot Mikie Sherrill, who bested a field of Democratic rivals to replace retiring New Jersey Republican Rep. Rodney Frelinghuysen. The favorite of Washington Democrats will take on Republican Assemblyman Jay Webber in one of several New Jersey races Democrats view as possible pickups.

In Alabama, four-term Republican Rep. Martha Roby was forced into a runoff election next month after failing to win 50 percent of her party’s vote. She will face former Democratic Rep. Bobby Bright in Alabama’s conservative 2nd District – where Trump loyalty has been a central issue.

Roby was the first member of Congress to withdraw her endorsement of the Republican president in 2016 after he was caught on video bragging about grabbing women’s genitals.

In New Mexico, Democratic Rep. Michelle Lujan Grisham won her party’s nomination in the race to succeed outgoing Republican Gov. Susana Martinez. If Grisham wins, she’ll be the state’s second Latino state executive.

Alabama Gov. Kay Ivey fended off three Republican challengers, while South Dakota Rep. Kristi Noem became the first female nominee for governor in her state.

In Iowa, 28-year-old Democratic state Rep. Abby Finkenauer was trying to become the youngest woman to serve in Congress.

And in New Mexico, former state Democratic Party Chairwoman Debra Haaland, a tribal member of Laguna Pueblo, won her primary and could become the first Native American woman in Congress if she wins this fall.

Haaland said in her primary victory statement: “Donald Trump and the billionaire class should consider this victory a warning shot: the blue wave is coming.”

Mississippi Republican Sen. Roger Wicker won his primary contest as did New Jersey Sen. Bob Menendez, a Democrat who faced federal bribery charges last year. The jury deadlocked, but Republicans hope to use Menendez’s legal troubles to tar other Democrats like Sherrill across the state.

Republican businessman Bob Hugin claimed the Republican nomination to face Menendez this fall.

In California, national Democrats spent more than $7 million trying to curb and repair the damage inflicted by Democrats attacking each other in districts opened by retiring Republican Reps. Ed Royce and Darrell Issa, and the district where Republican Dana Rohrabacher fended off a challenge from the right.

Republican Rep. Mimi Walters easily advanced to the November election in her Orange County district that has been targeted by Democrats.

And to the north, House intelligence committee chairman Devin Nunes, a Republican, qualified for the general election ballot as well. Nunes is a polarizing figure in national politics given his support for Trump in one of the many investigations into Russian meddling in the 2016 election.

A key Senate race took shape in the heart of Trump country as well.

Montana Republicans were picking a candidate to take on Democratic Sen. Jon Tester, one of the most vulnerable senators in the nation. State Auditor Matt Rosendale won the Republican nomination.

Associated Press writers Amy Taxin in Huntington Beach, Sophia Bollag in Sacramento, David Porter in Montclair, New Jersey, and Kevin McGill in Picayune, Mississippi, contributed to this report.