Superintendent of Public Instruction Tom Torlakson greets supporters during an election night watch party at the Citizen Hotel in Sacramento, Calif., on Tuesday. Torlakson held onto his position after a tight race with former charter school executive Marshall Tuck. (Andrew Seng/AP)

In a white-hot battle in California that is considered a proxy fight for deep national divisions in the Democratic Party over education, Tom Torlakson was narrowly reelected as the state’s schools superintendent, beating back Marshall Tuck by a margin of 52 percent to 48 percent.

The $30 million down-ballot contest generated three times as much spending as the race for governor, with money pouring in from around the country. Torlakson received heavy support from teachers unions while Tuck had the backing of billionaire philanthropists such as former New York mayor Michael R. Bloomberg (I), the heirs of Wal-Mart founder Sam Walton, and Laurene Powell Jobs, the widow of Apple founder Steve Jobs.

“We knew it wouldn’t be easy,” Torlakson said in a statement. “They were strong, but we were stronger. They were tough, but we were tougher. After all, we’re teachers — we did our homework.”

Many observers viewed the contest as a test of the power of organized labor in California, and it was one of the few election bright spots nationwide for teachers unions, whose candidates lost in bruising contests in Colorado, Florida, Ohio, North Carolina, Wisconsin and elsewhere.

The two national teachers’ unions spent a record-setting amount on state and local races, with few victories as a result.

Randi Weingarten, president of the American Federation of Teachers, blamed the losses on the GOP’s ability to nationalize many state races. Local issues such as education were overshadowed by voter dissatisfaction with President Obama, she said Wednesday morning.

“The Republicans successfully made it a referendum on the president,” said Weingarten, whose union spent about $20 million this election cycle. “In the few places where you had issues like education and you had a good candidate who could get through the torrent of negative ads, we were able to win.”

In Pennsylvania, the union backed Democrat Tom Wolf, who was able to unseat Gov. Tom Corbett (R). Corbett was a major target of the teachers unions after he made deep cuts to education and battled the unions over the Philadelphia school system.

In California, the top schools job has relatively little power; the superintendent largely carries out education policy set by the governor and his appointed state Board of Education. It is a nonpartisan post; both Torlakson and Tuck are Democrats.

Torlakson, 65, is a former high school biology teacher who became active in union politics. After his teaching career, he spent more than a decade serving in the state legislature, winning seats in the assembly and the state Senate.

Tuck, 41, had never run for elective office. He is a former president of Green Dot Public Schools, a chain of Los Angeles charter schools. He also is a former chief executive of the Partnership for Los Angeles Schools, a nonprofit school-turnaround group that operates more than a dozen public schools in that city. Before his work in education, Tuck was an executive at a software company and worked for two years in mergers and acquisitions at Salomon Brothers.

Their differences symbolized the tensions within the Democratic Party about the best way to educate the nation’s children. Torlakson pushed for more investment in public schools, does not believe student test scores should be used to judge teachers, and said charter schools need more oversight. Tuck supports expansion of public charter schools, argued for more accountability for teachers and said California’s teacher tenure laws are an obstacle to improving schools.

The stark contrast between the two was crystallized in their reaction to the landmark Vergara case, in which a state judge in June struck down California’s teacher tenure laws as unconstitutional and damaging to students. Tuck celebrated the ruling; Torlakson moved to appeal it.

Get updates on your area delivered via e-mail