The hard-fought primary campaigns for California governor are over, and the candidates left standing are Republican John Cox and Democrat Gavin Newsom .

The two will face off in the Nov. 6 general election in what is expected to be a testy race. Expect to see millions in campaign donations pour in, a fair share of attack ads and lots of chatter about President Trump .

For Cox, the path to victory is formidable. The Rancho Santa Fe businessman has never been elected to public office, despite several tries. Cox is not well known in California, and no Republican has won a statewide race in California since 2006. Democrats have a 19-percentage-point edge over Republicans in voter registration and, as of May, the GOP trailed behind Californians registered as “No Party Preference.”

Cox’s biggest coup in the primary race was nabbing the endorsement of President Trump. That helped him consolidate the Republican vote, assisting his rise to second place in the primary — but Trump’s nod likely will hurt him in November. Democratic presidential nominee Hillary Clinton crushed Trump by more than 4.2 million votes in California in the 2016 presidential election .

Newsom faces potential pitfalls as well. The Democrat has defended the gas tax and vehicle fee increases approved by the state Legislature and Democratic Gov. Jerry Brown . Funds from the increases will pay for much-needed transportation infrastructure projects in California, but the hikes are unpopular among voters. A statewide ballot measure to repeal the gas tax appears headed to the November ballot, and that may help Cox, who is chairman of the repeal campaign.

California also has the nation’s highest effective poverty rate, an affordable housing crisis and has seen a rapid increase of homelessness. Newsom has acknowledged that the Democrats “own” those problems since they’ve been in power, and Cox already said those issues will be the foundation of his attacks against the lieutenant governor.

“Given the party registration in this state, it looks very good for Newsom,” San Jose State political scientist Melinda Jackson said. “I hesitate to say it’d be a cakewalk because people thought that Trump would be a very weak candidate against Hillary Clinton and look what happened. Never say never.”

John Cox

Republican John Cox Kent Nishimura / Los Angeles Times

Top jobs: Businessman and real estate investor

Biggest splash: Cox was endorsed by Trump.

Baggage: He’s lost each of his previous campaigns for public office.

Particulars: Cox, 62, lives in Rancho Santa Fe and is married with four children. He is a graduate of the University of Illinois at Chicago and earned a law degree at Chicago Kent College at the Illinois Institute of Technology.

The venture capitalist announced his gubernatorial bid in early March 2017. He has contributed millions of his own money to fund his campaign.

Although this is the first time Cox has run for public office in California, he is not a newcomer to campaigns. He ran for president in 2008, bowing out after failing to get any traction. When he lived in Illinois, Cox ran for the House and twice for the U.S. Senate , including a race against Barack Obama. He lost all three times and also lost a race for Cook County recorder of deeds.

Cox is chairman of a statewide initiative campaign to repeal the gas tax and vehicle fee increases approved by the Democrat-led California Legislature and Brown. The billions raised would pay for much-needed road and bridge repairs. Cox has donated $250,000 to the campaign.

The Republican also unsuccessfully pushed a ballot initiative to overhaul Sacramento by establishing a “neighborhood Legislature,” which would add 12,000 “citizen legislators” elected in neighborhoods to the 80 Assembly members and 40 senators who currently make up the California Legislature. The intent, he said, was to rid Sacramento of “crony” politicians and the influence of special interests.

Coverage of California politics »

Gavin Newsom

Democrat Gavin Newsom. Kent Nishimura / Los Angeles Times

Top jobs: California’s lieutenant governor since 2011, mayor of San Francisco for two terms, from 2004 to 2011

Biggest splash: Newsom created a national firestorm as San Francisco mayor in 2004 when he ordered the city to issue same-sex marriage licenses.

Baggage: While mayor, he had an affair with his campaign manager’s wife.

Particulars: Newsom, 50 , lives in Marin County with his wife and four children. He is a graduate of Santa Clara University.

Newsom coasted to a first-place finish in the June 5 primary, beating a strong field of fellow Democrats that included former Los Angeles Mayor Antonio Villaraigosa , state Treasurer John Chiang and former state schools chief Delaine Eastin.

He launched his campaign for governor in February 2015, shortly after deciding not to challenge then-state Atty. Gen. Kamala Harris for the U.S. Senate.

Newsom pushed for a statewide initiative to toughen California gun laws and supported a measure to legalize the recreational use of marijuana. Voters approved both initiatives in the 2016 general election.

Newsom ran for governor in the 2010 election but dropped out after the entry of Brown, who went on to win. He ran for the lower-profile lieutenant governor’s office instead.

Newsom gained national attention as mayor of San Francisco in 2004 when he directed the city to begin issuing marriage licenses to same-sex couples. That was a catalyst for a nationwide political battle over the issue that ended when the U.S. Supreme Court affirmed the right of gays to marry in 2015.

California politics news feed »

phil.willon@latimes.com

Twitter: @philwillon

Updates on California politics

ALSO

It's Newsom vs. Cox in November as Villaraigosa tumbles in governor's race

Before John Cox was Trump's choice for governor, he was on a quixotic mission to remake California's Legislature

When Gavin Newsom issued marriage licenses in San Francisco, his party was furious. Now, it's a campaign ad