Congress gave approval to legislation that combines a transportation measure with bills to extend subsidized student loans and revamp flood insurance.

Congress gave final approval Friday to legislation that combines a two-year transportation measure with bills to extend subsidized student loans and revamp federal flood insurance, wrapping up a bruising session with measures that will be popular on the campaign trail.

The final $127 billion package angered fiscal conservatives and liberal environmentalists alike, but leaders in both parties — along with many rank-and-file lawmakers — wanted to put the issues behind them.

Exhausted members of both parties pointed to the legislation as a tonic for the ailing job market and proof Congress could get something done. The House passed it by 373-52, the Senate by 74-19. All the no votes were by Republicans. The Washington House delegation all voted for the measure, as did both senators.

“When all is said and done, this bill is what it is,” said Rep. Nick Rahall II, a West Virginia Democrat who was one of the senior negotiators. “It means jobs.”

Rep. Jaime Herrera Beutler, a freshman Republican from Washington state, called the measure “a symbol of how Congress is supposed to operate and why we are here.”

The transportation legislation extends federal highway, rail and transit programs for 27 months, authorizing $120 billion in spending, financed by extending the existing 18.4 cent-a-gallon gasoline tax and the 24.4 cent-a-gallon diesel tax for two years, and about $19 billion in transfers from the Treasury, according to Taxpayers for Common Sense, a watchdog group.

That was a retreat for many House conservatives, who had vowed to scale back or eliminate the fuel taxes and shift responsibility to the states.

The $6.7 billion student-loan provision extends the current 3.4 percent interest rate on Stafford loans for one year, financed by changes in pension laws and a restriction on the length of time students could get those loans. The flood-insurance program increases premiums and requires people living near levees to have coverage.

For Republicans, the measure violated a number of promises the new leadership had made to the tea-party-fueled electorate that brought it to power.

Bills were not to be bundled together at the last minute. They were supposed to be posted on the Internet 72 hours in advance, and they were generally to rein in — not expand — the scope of government.

During the 2010 campaign, Republicans taunted Democrats for enacting laws such as the health-care legislation that were too long to read. At 596 pages, posted Thursday night, few could have read this legislation.

“This is clearly not exactly what we wanted to do,” said Tim Huelskamp, a conservative freshman from Kansas. “People fear the government will just keep growing. This only serves to cement that.”

But Democrats had been pressing for months for action on the transportation and loan bills. Many students faced the prospect of their loan rates doubling to 6.8 percent on Sunday, and transportation projects would have ground to a halt.

Business groups had pushed hard for a long-term extension of federal transportation programs, while President Obama had made the loan issue a centerpiece in his campaign against a “do-nothing” Congress.

White House spokesman Jay Carney said aboard Air Force One that the measure was a “good, bipartisan” deal and the president looked forward to signing it.

House Republican aides crowed they had pulled that do-nothing campaign theme from under the president.

The compromise ended up sprinkled with unrelated nuggets dealing with Asian carp, roll-your-own tobacco and federal timber aid. But its most significant provisions dealt with transportation and student aid.

With only 29 days left on the House’s legislative calendar before the election, the real work of the 112th Congress may be done, at least until a lame-duck session that will be devoted to heading off a fiscal disaster Jan. 1.

That leaves three significant bills passed by the Senate in limbo: a major overhaul of federal farm programs, a revamping of the Postal Service and an expansion of the Violence Against Women Act.

Republicans boasted of streamlining environmental-review processes for transportation programs and shifting resources away from highway beautification and pedestrian and bike paths. Deron Lovaas, the federal transportation policy director at the Natural Resources Defense Council, called it a “shameful” throwback to highway bills of old that neglected more environmentally friendly forms of transportation.

Ryan Alexander, president of Taxpayers for Common Sense, called the legislation a “massive Treasury bailout of the transportation program.”

But with a deadline looming and no one wanting another short-term punt, both parties compromised. Republican leaders once again dropped the Keystone XL oil-pipeline provision, which would have mandated construction over the Obama administration’s objections, and a provision passed by the House blocking new regulations of coal ash. Senate Democrats excised $1.4 billion set aside for land and water conservation.

Material from The Associated Press is included in this report.