California voters swept Lt. Gov. Gavin Newsom into a solid lead for governor, while Republicans rallied to push businessman John Cox into second place, setting up a blue-red contest in November’s general election, according to preliminary results from Tuesday’s primary.

In the other statewide contest that will significantly impact California public school students, Marshall Tuck and state Assemblyman Tony Thurmond, both Democrats, took first and second place in the nonpartisan race for state Superintendent of Public Instruction. In California primaries, the top two vote-getters advance to the general election, even if they are from the same party.

Tuck, an education reformer who led Los Angeles school turnaround efforts, was ahead with 37 percent to Thurmond’s 34 percent, with 97 percent of precincts reporting. Of the other two candidates, Lily E. Ploski, a former college administrator from Orange County, had 17 percent, and Steven Ireland, an LA Unified parent and television producer, had 12 percent.

There were 27 names on the gubernatorial ticket. At the top throughout the entire campaign has been Newsom, a former San Francisco mayor and a core Democratic Party favorite, who has a commanding lead with 33 percent. San Diego County businessman Cox, who spent nearly $5 million on his campaign, was in a solid second place with 26 percent.

Antonio Villaraigosa languished far behind at 14 percent, a significant loss for the former Los Angeles mayor. Republican Travis Allen had 10 percent, State Treasurer John Chiang had 9 percent, and former state Superintendent Delaine Eastin had 3 percent.

At his “not a victory” speech, Newsom’s only comments on education were that it’s “time to reinvest in our public education system, once the envy of the world, and start treating teachers like heroes that they are.” He punched the word “public” while smiling at the San Francisco crowd’s enthusiastic applause.

Villaraigosa conceded just before 11 p.m. “There’s too big of a gap to overcome,” senior campaign adviser Mike Madrid told KTLA during Villaraigosa’s speech. Earlier in the evening, Villaraigosa had called for Los Angeles County polling places to remain open until Friday after a printing error inadvertently left 118,000 voters off the rolls, affecting about 2.3 percent of the county’s voters — including Henry Winkler, “The Fonz” from the 1970s sitcom “Happy Days.”

Absentee voters helped pushed Cox into the runoff. As of Tuesday on Public Data Inc.’s absentee vote tracker, 34 percent of returned ballots had come from Republicans. However, they make up only 25 percent of the state’s registered voters. Republicans vote in stronger numbers, which helped Cox keep Villaraigosa out of the No. 2 spot. Northern California voters are generally more reliable than Southern California voters, boosting both Newsom and Thurmond, a state Assembly member from Richmond. Both are backed by teachers unions.

When the first results of the evening were reported — based solely on the absentee ballots — Newsom had 34 percent, Cox 26 percent, and Villaraigosa 11 percent, figures that roughly held steady as poll results were tabulated.

Poor turnout by Latinos could have contributed to Villaraigosa’s defeat, particularly in Los Angeles, where he had hoped to pick up strong support. More than a third of the state’s Latino voters are in Los Angeles, and Los Angeles registration is 30 percent Latino.

Latinos generally wait to vote at the ballot box, and on Tuesday they appeared to stay home. As of Tuesday morning, they had the lowest rate of returned ballots — only 1 in every 10 mailed ballots had been returned. Among blacks, the rate was 1 in 6.

In Los Angeles County, Villaraigosa’s home base, he was 10 points behind Newsom.

Statewide turnout was showing at 21 percent but may grow as votes come in and last-minute absentee ballots are counted; Los Angeles County was at 18 percent.

Turnout in primary elections has been falling in Los Angeles County. Turnout in the statewide June primary in 2006 was 27 percent, dropping to 24 percent in 2010, and lower again, to 17 percent, in 2014.

Education reformers had spent heavily for Villaraigosa, who supports charter schools, with outside groups pouring more than $22 million into political advertising. But it wasn’t enough to secure their candidate a win. Villaraigosa ran as “the education candidate,” as he had when he was elected mayor of Los Angeles in 2005.

Newsom outraised Villaraigosa $35.9 million to $34.5 million, with the largest donation coming from the California Teachers Association. Newsom has said he is open to denying charter schools based on their fiscal impact on school districts. Current state law prohibits that, but the majority of the legislature was elected with union support, so if a bill made it to Newsom’s desk, it’s possible he wouldn’t veto it. Gov. Jerry Brown, who is termed out, often used his veto pen to stop bills that would have curtailed charters’ freedoms.

Newsom campaign ads contributed to Cox’s win and Villaraigosa’s downfall. Newsom made it clear he would rather face Cox than Villaraigosa in November. And with the state’s Republicans slipping to third place in the number of registered voters — behind Democrats and unaffiliated voters — Cox’s chances appear slim in November, despite support from President Donald Trump, who tweeted his support for Cox twice on Memorial Day. On Tuesday, Trump tweeted his support again: “In High Tax, High Crime California, be sure to get out and vote for Republican John Cox for Governor. He will make a BIG difference!”

After conceding, Villaraigosa called on his supporters to vote for Newsom in November. But a big question will be whether one of the gubernatorial candidates will pick up Villaraigosa’s focus on education.

“If a Republican makes the runoff for governor, or if either candidate for state superintendent wins outright in June, it’s going to be a very different race. And there will certainly be less of a focus on children and education leading up to the November election,” Ted Lempert, president of children’s advocacy organization Children Now, said before the primary.

Despite three recent polls that showed Cox’s lead over Villaraigosa widening, Gary Borden, executive director of California Charter Schools Association Advocates, said days before the election that he was optimistic that Villaraigosa would make the runoff. But he, too, expected education issues to fall off the radar if Cox kept his lead.

“If for some reason Villaraigosa doesn’t make the runoff, and it ends up being a Republican versus a Democrat, I think it takes a lot of the interest out of the governor’s race, because Cox doesn’t really have a chance of beating Newsom,” Borden said.

“At that point, I think the contest really takes on the same lines that are dominating the national contest. And that is a hyper-partisan, for-Trump versus against-Trump contest that frankly masks the real issues that Californians have an interest in.”

• This article has been updated with Wednesday morning vote results.

Read more about the election season at LA School Report’s EDlection 2018 roundup:

Read LA School Report’s interviews with all four superintendent candidates:

Marshall Tuck, 44 and a Democrat, lives in Los Angeles. He led Green Dot Public Schools, a network of independent charter schools in Los Angeles, and Partnership for Los Angeles Schools. He narrowly lost to Tom Torlakson in the 2014 race for state superintendent.

Tony Thurmond, 49 and a Democrat, is in his second term representing the Bay Area’s Richmond in the state Assembly. Thurmond served on the Richmond City Council from 2005 to 2008 and the West Contra Costa Unified school board from 2008 to 2012.

Lily E. Ploski, 44, is running as an independent. She was raised in public schools in Orange County and Riverside County and attended community college at Diablo Valley College in the Bay Area, where she found her life’s passion to work in education. Ploski is a former administrator at Solano Community College and teaches financial literacy to inner-city high school students in an Upward Bound program at Mills College.

Steven Ireland, 59, is nonpartisan, has never run for office before, and is running as “the parent candidate.” The only position he has held in education was PTA president at Toluca Lake Elementary School, in the Los Angeles area. Heworks full time as a television producer.