The state Legislature narrowly approved a plan to increase gas taxes and vehicle fees late Thursday, a move expected to raise tens of billions of dollars over the next decade to repair the state’s worn and aging transportation infrastructure.

Senate Bill 1, also known as the Road Repair and Accountability Act of 2017, raises the gas excise tax by 12 cents a gallon, with annual adjustments for inflation. Diesel excise taxes are going up 20 cents, while the diesel sales tax will rise from 1.75 to 5.75 percent.

Also, a new fee will be charged to vehicles based on their worth. And a $100-a-year fee is coming for zero-emission vehicles.

Combined, the new taxes and fees are projected to raise $52.4 billion over 10 years for road repairs and other transportation projects.

Under the bill, counties across California are set to receive an additional 104 percent in funding per year. For Los Angeles County, that means a total of $1.54 billion over 10 years. Individual cities are set to receive an additional 107 percent for street and road investments each year.

In Los Angeles, that means a total of $905 million over 10 years, whereas a suburban city like Pasadena can expect $32.5 million over 10 years.

Public transit agencies are also set to receive increased funding as a result of the bill. For instance, the Los Angeles County Metropolitan Transportation Authority is set to receive $438.7 million over the next decade, and Metro’s Southern California Regional Rail Authority will receive $80 million in that same time.

California Senate President pro Tempore Kevin de Leon, D-Los Angeles, said the bill will allow the state to close transportation funding shortfalls without burdening future generations with debt.

“These investments will create good-paying jobs, improve traffic safety and expand public transit access in communities across the state,” De Leon said in a statement.

Assemblyman Chris Holden, D-Pasadena, said the funds will help municipal organizations to make road safety improvements, fill potholes and repair local streets, freeways, bridges and overpasses.

“For decades, transportation in California has been getting worse and the funds to fix it having been drying up,” Holden said in a statement. “This compromise solution will save consumers in the long run and avoids borrowing funds that may result in cuts to schools, health, and public safety.”

Legislators haggled over the bill for the last week. The state Senate voted 27-11 t and the Assembly voted 54-26 to approve the bill Thursday. Both vote totals represent the minimum number of votes required to pass tax increases.

“Today, we made steps toward solving a crisis that affects every community in California,” said Assembly Speaker Anthony Rendon, D-Paramount, in a statement Thursday night. “Our roads and bridges are in bad shape. They waste our constituents’ time and money and put them in harm’s way.”

Assembly Democrats nearly did not have enough votes to approve the bill until a deal was struck with two Riverside Democrats, Sen. Richard Roth and Assemblywoman Sabrina Cervantes, to secure their ‘yes’ votes in exchange for $427 million in a budget trailer bill for transportation projects in their districts.

Sen. Steve Glazer, D-Orinda, the only Senate Democrat to vote against the bill, and Assemblyman Rudy Salas, D-Bakersfield, was the lone Assembly Democrat who voted against it.

Gov. Jerry Brown — who threw his full political force behind the package — began by saying he was glad to be a Democrat.

“The Democratic Party is the party of doing things,” he said. “And tonight we did something to fix the roads in California.”

Brown also said SB 1 was critical for public safety and the economy and that it would create tens of thousands of jobs.

The bill had faced stiff resistance from Republicans who said more taxes aren’t needed, noting that Californians already pay more for fuel than residents of other states.

“It hurts the poor. It hurts the middle class. It hurts small business owners,” state Sen. Jeff Stone, R-Temecula, wrote in an op-ed submitted to he Riverside Press-Enterprise. “It hurts those Californians, especially in Inland and rural areas, who often must drive long distances to get to their jobs.”

Reporters Jeff Horseman and Katy Murphy contributed to this report.