Democrats hold two-thirds majorities in the Senate and Assembly, and they needed nearly every one of those votes to get the measure through. The measure squeaked by on a 27-11 vote in the Senate and 54 to 26 vote in the Assembly.

In a test of his political clout, Brown campaigned hard for the measure, holding rallies and meeting with moderate Democrats who were skeptical of the plan. He convinced all but two Democratic legislators -- Sen. Steve Glazer of Orinda and Assemblyman Rudy Salas of Bakersfield -- to go along.

Glazer said in a statement his constituents were overwhelmingly against the bill. His vote came after he failed to gain support for a provision that would ban strikes by BART's unionized workforce.

In the end, it was good old-fashioned politics that may have gotten the job done: Brown and Legislative leaders agreed to add more than $800 million in pet projects to a budget trailer bill to get the transportation package over the finish line.

The money — added to the budget trailer bill because it was too late to amend the transportation measure — would send $420 million to four Riverside County road projects, $6.3 million to a Stockton bridge-widening project, and $400 million to extend the commuter rail line, the Altamont Corridor Express, to Ceres and Merced. That train now runs from San Jose to Stockton.

The money for the Altamont Corridor Express was apparently enough to get Republican Sen. Anthony Canella, of Ceres, on board, and ensure that moderate Democratic Assemblyman Adam Grey of Modesto would vote for the bill.

"I mean, I would have loved to have done something different," Cannella said of raising fees and taxes to pay for the plan. "But when I'm able to deliver $400 million for ACE train, $100 million for Campus Parkway to help UC Merced ... it's probably the biggest thing that's ever happened in my district as far as investment. I feel good about that."

Cannella was the only Republican in the Legislature to vote for the bill.

The Riverside County money seemed to also convince Democrats Richard Roth in the Senate and Sabrina Cervantes in the Assembly to support the package.

The majority of Republicans, who say they were largely left out of negotiations, decried the tax increases used to pay for the measure, which includes a 12 cent per gallon increase to the gas tax. Sen. Jeff Stone, of Temecula, said the increase will have the biggest impact on those who can least afford it.

“I have senior citizens that have to choose between drugs and gasoline or food in a state where one in four children go to bed hungry every single night,” Stone said.

GOP lawmakers argued that the state is already bringing in enough revenue to pay for highway and infrastructure upgrades and should pay for projects out of the state's general fund. Democrats have said tapping the general fund would require cuts in other areas, such as education and social services.

The cost of providing emergency fixes to the state highway system has been on an upward trend for the last few years. And this winter's storms have inflicted an estimated $866 million in damage on roads and highways throughout the state -- the highest total in decades.

Lawmakers also voted to place a constitutional amendment on the ballot that supporters say will restrict the new tax revenue to transportation spending. That measure must go before voters in 2018.

The measure passed Thursday night goes only part of the way toward meeting the projected spending gap for transportation infrastructure. The state says it faces a $59 billion backlog in deferred highway and bridge maintenance. The tab is estimated to be even higher -- $78 billion -- for local streets and roads.