GOV. ROBERT F. MCDONNELL (R) said it best when he signed his name the other day to Virginia’s landmark transportation bill, a $6 billion leviathan that fixed a funding shortfall a quarter century in the making. “The only bad thing from this bill,” the governor said at a ceremony in Richmond, “is people will be complaining about construction rather than congestion.”

Mr. McDonnell campaigned four years ago on the premise that he could tackle the state’s drastic transportation funding shortfall without resorting to tax increases. That was a fiction designed to appeal to his Republican base and financially pinched voters reeling from the recession.

To his credit, though, the governor never entirely ruled out new taxes. In fact, first he systematically squeezed every penny he could from the state’s existing revenues for transportation, thereby demonstrating (since the state’s road network was still billions of dollars short) that without new taxes the problem could not be solved. His approach — strategically savvy and logically irrefutable — robbed the no-taxes-ever crowd of any coherent argument.

In the end, the governor wound up with a plan that was bigger than he bargained for and not entirely to his liking. The law scraps the long-standing flat, per-gallon gas tax, replacing it with a wholesale levy linked to inflation; raises the state sales tax by 6 percent; shifts some existing revenue to building and maintaining roads; and raises the car titling tax.

By some measures, the bill, passed largely thanks to Democrats in the GOP-dominated state legislature, is the biggest tax increase in Virginia history. But anything short of that would have left the problem to fester, and the state’s roads, rails and bridges oversubscribed and under-maintained.

The new money starts to flow almost immediately. It will kick-start projects already in the pipeline and add new ones long hoped for by traffic-weary motorists. More than half of the new money will be spent on highways and bridges. In all, it adds $4 billion— a third of it for traffic-clogged Hampton Roads — to what will now be a $15.4 billion transportation spending program administered by Richmond over the next six years. In addition, $1.9 billion in new funds will be separately allocated for projects in Northern Virginia, the most congested region.

Mr. McDonnell, whose fellow Republicans argued for years that taxpayers could not absorb any tax increases, has suffered for his sacrilege. He was condemned by Grover Norquist, the anti-tax guru, and, soon after the legislation was enacted in March, he was excluded from the Conservative Political Action Conference, a beauty contest for GOP presidential hopefuls.

But Virginians continue to give the governor high poll ratings. By elevating problem-solving over politics, Mr. McDonnell safeguarded the state’s infrastructure and long-term competitiveness. That’s a real achievement.