High speed rail survived by the skin of its teeth today.

In a closely watched vote of the California state Senate, a bill to issue the first $5.8 billion in bonds for the construction of high speed rail lines passed 21-16. It needed all 21 votes to pass. Four Democrats voted no – including Allen Lowenthal, the Democratic candidate for Congress in CA-47, and Fran Pavley, the author of the state’s historic global warming law – but ultimately, just enough Democrats voted in favor of the bonds for them to pass. Joe Simitian and Mark DeSaulnier were the other Democrats who opposed the bill.

The bonds, authorized by Proposition 1A in 2008, will now have their first issue. Most of the money, along with $3.2 billion in federal funds, will go toward construction on the first set of rail lines in the Central Valley. $2 billion will go toward upgrades to existing track in the Los Angeles and San Francisco regions, making them ready to accept high speed rail cars.

The bill was on shaky ground, with several state Senate Democrats on the fence. Governor Jerry Brown, a supporter of the project, met with many of those wavering votes last night. A poll by Mervyn Field suggested, implausibly, that this vote would hurt the prospects of a ballot initiative in November that will raise taxes to fill a budget hole. I doubt you will hear more than a low whisper about the high speed rail vote during that initiative fight in the fall.

This does not end the battle for high speed rail. Between the bond issue and the federal money, that covers only about 1/5 of the total funding needed for the full project, which would connect Sacramento and San Diego and all points in between by high speed rail. But if this died today, you can be certain that nothing would ever get built. The federal government was prepared to take away the $3.2 billion in stimulus dollars earmarked for this stage of the project. And faith in the future of high speed rail in California – and indeed the nation – would have been sapped.

It’s rare to see a victory on investment and infrastructure in this age of austerity, but California provided one today.