Republican attorney Catharine Baker’s surprise victory over Dublin Mayor Tim Sbranti for an East Bay Assembly seat was an unexpected gift for the GOP, a foothold in the Democrats-only bastion of the Bay Area.

But Baker’s narrow win also highlighted the ever-growing clout of independent expenditure groups in California politics, fueled by their ability to raise unlimited amounts of money for candidates.

Although the groups can’t work directly with individual campaigns, they share a common goal.

“We knew we were going to get outspent, so the independent expenditure was hugely important,” said Justin Matheson, a consultant for Baker’s campaign. “It kept us in the game.”

The numbers tell the story.

Sbranti’s campaign raised about $3.1 million, with much of it coming from Democratic Party organizations across the state. A big chunk of that cash was spent during a bruising June primary battle, when Sbranti beat two fellow Democrats to take the second spot on the November ballot.

Baker, who finished on top in the primary, took in about $625,000 in direct contributions.

Those figures were substantially boosted by the money outside groups poured into the race to replace termed-out Democratic Assemblywoman Joan Buchanan.

On the Democratic side, Californians for Economic Prosperity, a group formed to help Sbranti, raised about $3.1 million for his election. The California Teachers Association put up nearly $1.2 million of that for the former leader of its political involvement committee, and other public employee unions kicked in most of the rest.

Baker, though, had the backing of JobsPAC, a California Chamber of Commerce group funded by companies including Safeway, Pacific Gas and Electric Co. and Philip Morris.

Her biggest supporter was Spirit of Democracy California, which spent at least $1.8 million to elect her. Much of that came from Charles Munger Jr., a Peninsula physicist who has given millions to GOP candidates and causes in the state.

“The role of independent expenditures and the actual dollars they spend are huge,” said Michelle Henry, a spokeswoman for the Sbranti campaign. “With a billionaire pumping money into races, one person can decide what happens.”

Not their friend

That decision-making process can be pretty simple, said Marty Wilson, a longtime GOP political strategist who now serves as the California chamber’s vice president for public affairs.

“We need more allies in the Legislature, and we felt that (Sbranti) wouldn’t be one,” said Wilson, whose political action committee spent a combined $400,000 to back Baker and oppose Sbranti. “We’re the Chamber of Commerce and he’s the labor boss, and we tend not to see eye to eye on many issues.”

The outside groups filled mailboxes in the district with dozens of brightly colored mailers, most of them attacking the opposition.

Baker, a mother of school-age twins and a volunteer in local schools, was attacked as a special-interest-funded campaign lawyer who was “just too extreme for our community.”

Sbranti, a veteran teacher, coach and local official, was slammed as someone who protects bad teachers by fighting against education reform and who “works for special interests, not for us.”

How well the mailers worked is an open question, Matheson said, although he acknowledged that people saw them and remembered them.

“At the same time, when you’re getting five or six pieces a day, you tend to get numb to them,” he said.

Underlying the campaign were last year’s BART strikes and Sbranti’s support of the transit district’s unions. It was a major issue during the primary, with Democratic Orinda City Councilman Steve Glazer calling for a statewide ban on transit strikes.

BART strikes an issue

Glazer didn’t officially endorse Baker after losing the primary, but he did appear in a picture with the Republican on one of her mailers, saying that “Baker would ban future BART strikes and Sbranti would not.”

Unhappiness about the BART strikes “was through the roof among independent voters,” Matheson said, in a district stretching from Livermore to Lafayette where thousands of people ride the system.

It was such a major issue that it could have swung the election to the Democrats if Glazer had finished ahead of Sbranti in the primary, he added.

Baker could hit Sbranti as a typical union guy, linked to partisan Democrats, the GOP consultant said. Glazer, however, “was a bit of an independent, a maverick. With Steve Glazer in the race, it would have been a completely different scenario.”

While Democrats hold a 39 percent to 32 percent registration edge over Republicans in the district, that leaves 29 percent of the voters who don’t identify with a major party.

“We heavily focused on that,” Matheson said. “We put out ground teams who only talked to people outside traditional party lines.”

First in 8 years

Still, it wasn’t easy to persuade party leaders and GOP donors that Baker had a chance, Matheson said. No Republican had been elected to the Legislature from the Bay Area since 2006, when former Assemblyman Guy Houston won his last race in a district that included some of the same territory Baker and Sbranti fought for.

But when Democratic Party money started to pour into the race in mid-September, Matheson said, “we knew it was a race.”

Much of the blame for the final result falls on the Democrats, said Henry, Sbranti’s spokeswoman.

Nasty battle’s fallout

Besides the lingering fallout from the nasty Democratic battle in the top-two primary, where “it’s every man or woman for themselves,” the lack of an exciting top-of-the-ticket race for governor and general disinterest in elections statewide spelled trouble in advance, she said.

“We had a very low turnout and Democrats didn’t vote,” she said. “There was nothing to bring people out, and that puts a seat like this in play.”

John Wildermuth is a San Francisco Chronicle staff writer. E-mail: jwildermuth@sfchronicle.com Twitter: @jfwildermuth