Republican John Cox has secured a spot on the ballot to face Democratic Lt. Gov. Gavin Newsom in the California gubernatorial election in November, boosted by a late endorsement from President Trump and voter discontent over liberal state policies.

Fox News projects that Cox will advance to the general election in the race for governor, outpacing a former Democratic mayor for the No. 2 spot on the ballot. The state's jungle primary system allows the top two finishers to advance regardless of party.

The result is disappointing for Democratic former Los Angeles Mayor Antonio Villaraigosa, who was widely considered the most viable potential challenger to Newsom in November's general election in the extremely liberal state.

Democrats' hopes of retaking Congress in November and mounting a national challenge to President Trump's agenda hang in the balance, meanwhile, as ballots continue to be counted in several key House races in California and seven other states with primaries Tuesday.

Trump said in a May tweet that Cox will "Make California Great Again," rallying the state's conservative base around the businessman and saying he could solve California's "high crime, high tax problems."

"This is only the first step to turning around this state and taking back California for all Californians," Cox told supporters in San Diego.

Fox News also projects that Sen. Dianne Feinstein will place first in the state's jungle primary -- a widely expected result. She will likely face ultra-progressive State Sen. Kevin de Leon in November, who delivered remarks early Wednesday strongly suggesting that he will be the runner-up.

"This is only the first step to turning around this state and taking back California for all Californians." — GOP gubernatorial candidate John Cox

The state's key House races, though, are still too close to call. The winners and losers in California's most competitive races could take days to sort out given the state's unique election laws.

There were some results in from the House races early Wednesday. Republican Rep. Mimi Walters easily advanced to the November election in her Orange County district that has been targeted by Democrats. The second spot remained up for grabs.

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.

Democrats need to flip 23 Republican-controlled to retake the House from the GOP in November. Out of California's 53 House seats, Republicans hold 14 -- and seven of those GOP-held districts backed Hillary Clinton in 2016.

That makes the Golden State center stage for what Democrats are hoping is a major anti-Trump wave in November.

In several races, either Republicans or Democrats face the very real prospect of being denied a place on the ballot in the general election.

CALIF JUDGE IN SEX-ASSAULT CASE FACES RECALL VOTE

That's because of California's nonpartisan, open "jungle primary" system, which advances the top two vote-getting candidates to the general election -- regardless of their party affiliation.

The risk is particularly high for Democrats, who are riding a wave of anti-Trump enthusiasm in California. So many Democrats are running in three of the House races that they might split the vote to such an extent that two Republicans end up with the most ballots.

That result would lock Democrats out of competing in the general election in some of the most vulnerable Republican districts, a kind of embarrassing political "own goal" that would highlight the quirks and perils of California's unique primary procedure.

Seven other states held primaries on Tuesday, including New Jersey, Alabama, Mississippi, New Mexico, South Dakota, Iowa and Montana. Click here for results from those key races.

More on California's closest races:

The governor's race

Newsom, a liberal establishment Democrat who previously served as mayor of San Francisco, will win one of the two spots in the jungle primary and therefore will advance to the November ballot, Fox News can project.

Republican businessman Cox will face him. But Newsom is the clear favorite in November's statewide contest, given California's overwhelmingly liberal electorate.

Some Democrats cried foul earlier this month after Newsom ran ads that reminded voters of Cox's connections with Trump and the NRA, saying the frontrunner was implicitly trying to rally conservatives to the polls to ensure Cox beat Villaraigosa for the second spot on the ballot.

The House races

One of the most hotly contested races is in the 48th Congressional District, which includes Newport Beach and Laguna Beach. Hillary Clinton narrowly won the district in 2016. Republican Rep. Dana Rohrabacher, who has held the safe seat without serious challenge for decades, faces eight Democrats and fierce competition from GOP rival Scott Baugh.

So many Democrats are running for the seat that none may end up getting the votes needed to appear on the ballot in November.

WATCH: IS DANA ROHRABACHER BEING GROOMED AS A RUSSIAN AGENT? TUCKER TAKES ON LIBERAL HYSTERIA

A similar situation might play out in California's 49th District, where a broad array of candidates is vying for the seat vacated by retiring GOP Rep. Darrell Issa. Eight Republican candidates are in the running, along with four Democrats who are neck-and-neck. The sheer number of entrants in the race could lock out either the GOP or the Democrats in November. Hillary Clinton also won here in 2016, by a margin of a little over seven points.

Another closely watched race was the effort by four Democrats to unseat incumbent Republican Rep. Walters in the 45th District in Orange County, which no Democrat has ever represented but that also supported Clinton in 2016. Walters voted to repeal ObamaCare, which has become a hot-button issue in the increasingly liberal district. On Tuesday, Walters easily advanced to the November election. The second spot remains up for grabs.

Important GOP-held seats with incumbents facing challenges are the 50th District, where Rep. Duncan Hunter is under investigation for misuse of campaign funds; the 10th District held by Rep. Jeff Denham; the 21st District, where Hillary Clinton won convincingly, that is currently occupied by David Valadao; and the 25th District, where Rep. Steve Knight is facing several challengers.

Ed Royce, who was first elected to Congress in 1992 and chairs the House Foreign Affairs Committee, announced his retirement earlier this year. He will vacate his 39th District seat, and several Republican and Democratic candidates are competing to replace him. That setup, again, raises the possibility of one party being knocked entirely out of the November contest.

The Senate race

Sen. Dianne Feinstein, D-Calif., will place first in the jungle primary, Fox News projects, even though the California Democratic Party pointedly declined to endorse her in February.

The majority of the votes from delegates at the party's annual convention went to State Sen. Kevin de Leon, Feinstein's progressive challenger who served as the former president pro tempore of the California Senate. Republican James P. Bradley, another hopeful in the primary, is not expected to make it to November's contest.

At 84 years old, Feinstein is the oldest senator in the U.S., and California's increasingly liberal demographics raised concerns during the campaign that even Feinstein may be too moderate for the state's new progressive wing. But her strong party backing, financial position and name recognition have offset those potential stumbling blocks.

In remarks early Wednesday, Kevin de Leon didn't claim the second-place spot, but strongly suggested he'll be facing Feinstein in November.

"A majority of Californians want new leadership in Washington,' he said. "In November, voters will have the opportunity to send a message to Washington, and around the world that the system is broken, the status quo is failing, and the future is now."

Fox News' Alex Pappas and The Associated Press contributed to this report.