Congress scored the first of what could be a series of bipartisan year-end victories late Thursday night with the final passage of a $305 billion measure to fund roads, bridges, and rail lines.

The five-year infrastructure bill is the longest reauthorization of federal transportation programs that Congress has approved in more than a decade, ending an era of stopgap bills and half-measures that left the Highway Trust Fund nearly broke and frustrated local governments and business groups. President Obama will sign the bill into law, as it fulfills his long-running push for lawmakers to pass an infrastructure bill even though it is significantly less than the $478 billion he sought in his own plan earlier this year.

The Senate approved the highway bill on an 83-16 vote. All but two Democrats—Senators Elizabeth Warren and Tom Carper—voted for it. Among the 14 Republican opponents were three of the four presidential candidates serving in the Senate: Ted Cruz, Marco Rubio, and Rand Paul. (Senator Bernie Sanders missed the vote.) The House cleared it, 359-65, earlier on Thursday. It won unanimous support from Democrats and opposition mainly from conservatives. Negotiators had struck a deal on the legislation only on Tuesday, but the House and Senate needed to act quickly before the Highway Trust Fund again ran dry.

Perhaps the most important single provision in the 1,300-page bill had little to do with transportation. It was the renewal of the Export-Import Bank, the federal lending agency that Congress allowed to expire with its inaction over the summer. While relatively obscure to much of the public, the battle over the bank’s future had become a fierce fight within the Republican Party. Conservatives assailed it as a form of corporate welfare and crony capitalism that benefits giants like Boeing and G.E. that shouldn’t need government help. But along with most Democrats and under heavy pressure from business groups, moderate Republicans warned that its demise would cost jobs in their districts. Test votes in the House and Senate demonstrated that the Export-Import Bank maintained majority support, and in the end, Republican leaders did not object to its inclusion in the highway bill.

Congress will now turn its attention to passing a rewrite of the No Child Left Behind education law and to striking a deal on an omnibus spending package to fund the government through September and avoid a shutdown next week. The debate over infrastructure funding won’t end, but it moves to the presidential campaign trail. Hillary Clinton has proposed spending $275 billion on top of what Congress just authorized, while Sanders has called for a more robust program costing $1 trillion in taxpayer money. Several plans from Republicans would cut federal infrastructure spending, although it is the current GOP frontrunner, Donald Trump, who has spoken the most about the need to upgrade the nation’s outdated infrastructure.