Congress passed a $1.1 trillion spending measure that averts a U.S. government shutdown and ends a 40-year-old ban on crude oil exports, a plan that ensures fiscal peace in Congress through most of 2016.

The Senate passed the bill 65-33 on Friday, shortly after a 316-113 House vote. The legislation, which will finance the government through September 2016, went to President Barack Obama, who signed it.

“I’m not wild about everything in it. I’m sure that’s true of everybody,” Obama told reporters at the White House during his end-of-year press conference. “But it is a budget that, as I insisted, invests in our military and the middle class.”

The president praised House Speaker Paul Ryan, elected to the post Oct. 29 after Republican insurgents drove John Boehner out of Congress. “He is respectful of the process and respectful of how legislation works,” Obama said. “So kudos to him as well as all the other leaders and appropriators involved in this process.”

The end of the 40-year ban on most U.S. crude oil exports is a “big win,” according to Ryan of Wisconsin, and it’s a top priority for Republicans. Democrats call it a giveaway to oil companies, and in exchange they negotiated extensions of environmental measures including solar and wind energy tax credits.

The two measures, combined in H.R. 2029, include about $680 billion in revived tax breaks over the next 10 years. A number of them would be made permanent, including those for business research and development, small business expenses, individual deductions for state and local sales taxes, and financing rules for multinational corporations.

Vote Drama

Republicans and Democrats in Congress have fought over taxing and spending for years, causing a 16-day partial government shutdown in 2013 and twice bringing the U.S. to the brink of a default on the federal debt. Public opinion polls blamed Republicans for the turmoil, and the party under Ryan — elected Oct. 29 to replace John Boehner — wants to avoid a repeat with the 2016 presidential election approaching, to show that Republicans can govern.

The outcome of the House vote on the spending measure was not without drama. Even though Minority Leader Nancy Pelosi backed the plan and urged fellow Democrats to vote for it, she had said Thursday she wasn’t confident her party could deliver enough votes to help Ryan get it passed. A number of conservative members of the Republican majority opposed the measure because they said it spends too much money.

‘Deficit Buster’

“It is going to bust the deficit. We are not doing anything for yet another year to take the debt burden off our kids and grandkids,” Republican Representative John Fleming of Louisiana said Thursday.

Senators voting for the bill include 27 Republicans, 37 Democrats and one independent, while 26 Republicans, six Democrats and one independent opposed it.

In the House, 150 Republicans and 166 Democrats voted for the measure, while 95 Republicans and 18 Democrats opposed it. Ryan relied on Democratic votes to help pass the measure as Boehner often had to do. The former speaker’s decision to turn to Democrats for votes was a major complaint of the Republican insurgents who ousted him.

Still, Ryan got support from more than the 79 Republicans who voted for a two-year budget plan the day before he became speaker. Ryan has emphasized this week that the spending bill is the product of a process he inherited from Boehner and that he’ll pursue a different strategy next year.

‘Big Oil’

“They had to put big oil in the omnibus” to get the spending measure passed, Pelosi told reporters Friday before the vote. Democrats had wanted the oil provisions to be added to the tax proposal instead.

Conservatives were unhappy when the final version omitted some policy provisions they wanted, including defunding Planned Parenthood and blocking Syrian refugees from entering the U.S.

Senator Ted Cruz of Texas, a Republican presidential contender, criticized Republican leaders in an opinion article in Politico that said the bill “effectively forfeits our massive Republican victories of 2014 and cements Obama’s priorities for nearly the full remainder of his term.”

In a letter Thursday urging fellow Democrats to support the spending bill, Pelosi wrote, “Personally, I was dismayed by Republicans’ insistence on lifting the oil export ban.” But she said Republicans’ “desperate thirst for lifting the oil export ban empowered Democrats to win significant concessions throughout the omnibus, including ridding the bill of scores of deeply destructive poison pill riders.”

Both Parties Upset

Representative Joe Barton of Texas, the lead Republican pushing oil export legislation in the House, said, “There are a lot of Republicans upset by what is not in the bill, there are a lot of Democrats who are upset because of what is in the bill.”

Oil producers, including Continental Resources Inc., Pioneer Natural Resources Co. and ConocoPhillips, have been pressing for an end to decades of restrictions on exports of most raw, unprocessed crude oil imposed at a time of shortages in the U.S.

The spending measure includes Republican wins such as a provision prohibiting the Securities and Exchange Commission from requiring publicly traded companies to disclose their political contributions.

It would scale back a program that allows visa-free entry to the U.S. for citizens of about three dozen countries, including much of Europe. People who have traveled recently to Iraq, Syria or other countries with significant terrorist activity would have to go through the normal visa process.

Meat Processing

The measure would benefit industries including health care, broadcasting and meat processing, increase funding for the FBI, and boost money for child hunger programs. It would restore health benefits for first responders to the Sept. 11 terror attacks who became sick because of their work, and provide health care aid for cash-strapped Puerto Rico.

The legislation would ratify an International Monetary Fund plan approved in 2010 to increase the voting share of emerging economies and double the amount of permanent funding available to the Washington-based fund. Until now, Republican opposition has prevented the IMF from implementing the changes.

The tax-extension measure passed by the House Thursday would also make permanent an enhanced child tax credit and the earned income tax credit, both Democratic priorities, as well as tax breaks for charitable giving and schoolteachers’ expenses.

Cadillac Tax

The two pieces of legislation would suspend three taxes intended to fund the Affordable Care Act — a so-called Cadillac tax on high-cost health insurance plans would be delayed from 2018 to 2020; a 2.3 percent tax on medical devices would be paused in 2016 and 2017; and a fee on health insurers would be paused for 2016.

Not everyone was on board. West Virginia Senator Joe Manchin, a Democrat, said on the Senate floor Thursday that he planned to oppose the bill because of the amount it would add to the federal deficit.

“I cannot stand here and vote for a bill that tells middle-class Americans, students and veterans, doctors and nurses, mothers and fathers and our seniors that these are our values,” Manchin said. “I would hope we would all think twice before voting for this absolutely unresponsible, irresponsible piece of legislation that adds another $700 billion to the debt.”