Solar panels are shown atop a housing complex funded by the California Solar Initiative's Multifamily Affordable Solar Housing (MASH) program in the state's National City, Nov. 19, 2015. Reuters/Mike Blake

The U.S. Congress voted on Friday to repeal the 40-year-old ban on exporting U.S. crude oil in an energy policy shift sought by Republicans as part of a bipartisan deal that also provided unprecedented tax incentives for wind and solar power.

The Senate, on a 65-33 vote, passed a $1.1 trillion government spending bill that included the measure to lift the export ban and provide five-year extensions of tax breaks to boost development of renewable energy. Earlier in the day, the House of Representatives passed the measure, 316-113.

The legislation now goes to President Barack Obama, who was expected to sign it into law.

The deal was hammered out in secret talks among congressional leaders over two weeks.

Sens. Lisa Murkowski, an Alaska Republican, and Democrats Heidi Heitkamp of North Dakota and Martin Heinrich of New Mexico had worked for more than a year to get the deal.

Democrats who backed the deal asserted its provisions encouraging renewable energy were important for combating global climate change.

"This is the biggest deal for addressing climate change that we are going to see," Heinrich said in an interview.

Heinrich said Democrats may not have been able to get a better deal even if they controlled both chambers of Congress, now led by Republicans. Many Republicans have opposed Democratic proposals to address climate change.

Congress, concerned about U.S. dependence on imported oil, imposed the crude oil export ban after the Arab oil embargo of the early 1970s that sent gasoline prices soaring and contributed to runaway inflation. Arab members of OPEC imposed the embargo following the U.S. decision to re-supply the Israeli military during the 1973 Arab-Israeli war.

Drillers have said lifting the ban would increase U.S. oil security and give Washington's allies in Europe and Asia an alternative source of crude beyond OPEC and Russia. The bill could benefit oil companies including Exxon Mobil Corp, ConocoPhillips and Chevron.

Opponents of lifting the export ban said the action would harm the environment and could lead to an increase in fiery derailments of crude-carrying trains.

Oil boom

Drillers said continuing the ban would choke a boom in shale oil production since 2008 particularly in North Dakota and Texas that has pushed domestic oil prices down from more than $100 a barrel to less than $40.

Lifting the ban was "particularly important at a time when our industry is experiencing a period of extreme volatility and uncertainty," Ryan Lance, chairman and CEO of ConocoPhillips, said in a statement.

House Democratic leader Nancy Pelosi and some others in her party had expressed concern that allowing U.S. oil exports would hurt independent refiners by raising the price of domestic crude to international prices.

Tom O'Malley, executive chairman of refiner PBF Energy, said lifting the ban would lead at least one East Coast refinery to shut down, adding his refineries in New Jersey and Delaware are less exposed.

"This is a crazy thing to do," O'Malley said. "Once you lift it, it's hard to reverse it."

Democrats in the Senate had secured some protections for independent refiners, allowing them to deduct transportation costs for gasoline and other fuels they make.

Pelosi Friday said Democrats walked away with a victory, in the trade of oil exports for environmental goals.

She said the environmental damage from exporting oil would be offset by 10 times because of measures in the bill such as the renewable power tax credits, funding of a parks conservation fund paid for with oil revenues and the elimination of measures that would have dismantled Obama's clean power rules on power plants.

Due to a global glut in oil supplies, lifting the ban is not expected to lead to significant U.S. export shipments for months or even years, but it could give crude producers the increased flexibility they coveted.

"Now that we have leveled the playing field, the United States finally has an opportunity to compete and realize our nation's full potential as a global energy superpower," said George Baker, head of Producers for American Crude Oil Exports, a group that formed last year to press lawmakers to open the trade.