California Superintendent of Public Instruction Tom Torlakson greets supporters in Sacramento, Calif., on Tuesday. Torlakson, who was supported by the teachers unions, kept his job after a tight race with former charter school executive Marshall Tuck. (Andrew Seng/Associated Press)

The nation’s major teachers unions suffered losses across the country Tuesday, despite pouring about $60 million into federal, state and local races in the midterm elections.

“We knew this was going to be an uphill battle,” said Lily Eskelsen García, president of the National Education Association, the country’s largest labor union. “But I don’t think anybody on our side, and we’ve got some very savvy people, anticipated going over the falls like this. Tectonic plates have shifted. And we’re going to have to come back with a new way of organizing for these kinds of races.”

The unions, which are traditionally closely aligned with the Democratic Party, tried but failed to defeat Wisconsin Gov. Scott Walker, a Republican who was a top target because he limited collective bargaining and ended automatic dues deductions for public sector unions in the state. In Illinois, Maine, Georgia and Kansas, union-backed candidates all fell to Republicans.

“Our union and members and the kids that we serve have more challenges today than they had yesterday,” said Randi Weingarten, president of the American Federation of Teachers, which spent $20 million on midterm races. She blamed the defeat on the GOP’s ability to nationalize many state races.

“The Republicans successfully made it a referendum on the president,” she said. “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.”

But the union also lost ground to Democrats who embrace policies that labor opposes, such as expansion of public charter schools, reform of public-employee pensions and the use of student test scores to evaluate teachers.

In Rhode Island, Democrat Gina Raimondo was elected governor in the face of opposition from teachers and other public-sector union members whose pensions she cut when she was state treasurer.

“The surprising thing is you now have Democrats who are willing to buck the union,” said Howard Wolfson, an adviser to former New York mayor Michael R. Bloomberg (I), who contributed to Democratic and Republican candidates around the country who want to introduce more choice and competition in public education, and greater accountability for teachers. “You can take reform positions and be successful not only in general elections, but in primaries. It’s a major sea change in the Democratic party that you can now oppose the union and be successful.”

The unions did have two bright spots Tuesday.

In Pennsylvania, Democrat Tom Wolf beat incumbent Gov. Tom Corbett (R).

Corbett was a major target of the teachers unions after he made deep cuts to education spending and battled the unions over the Philadelphia school system.

And in the white-hot battle in California for state schools superintendent, the union’s choice, Tom Torlakson (D), was narrowly reelected, beating back Marshall Tuck (D) by 52 percent to 48 percent.

While both are Democrats, they differ over the best way to improve public education, reflecting a schism within the national Democratic Party. Torlakson pushed for more investment in public schools, does not believe student test scores should be used to assess 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 down-ballot contest generated $30 million in spending, three times as much 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 Bloomberg, the heirs of Wal-Mart founder Sam Walton, and Laurene Powell Jobs, the widow of Apple co-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.”

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 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 the investment bank Salomon Brothers.

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.