WASHINGTON — 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 Garcia, 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 the 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 Bloomberg, an independent 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 a bright spot Tuesday. In Pennsylvania, Democrat Tom Wolf beat incumbent Republican Gov. Tom Corbett.

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.