By Richard Cowan and Susan Cornwell

WASHINGTON (Reuters) - Brushing aside concerns about deepening the budget deficit, U.S. lawmakers approved $1.8 trillion worth of federal spending and tax breaks on Friday in a rare case of bipartisan action after years of damaging fiscal fights in Congress.

The Senate voted 65-33 to approve sweeping legislation that averted a government shutdown, locked in billions of dollars of tax breaks and scrapped a 40-year-old ban on the export of U.S. oil.

Negotiations on Capitol Hill were mostly free of the acrimony that has blighted similar talks for the past five years and forced lawmakers to produce a succession of stopgap measures just to keep the government running.

"I think the system worked" this time, President Barack Obama said during a White House news conference.

He later signed the bill into law in a low-key Oval Office ceremony.

It was a win for new House of Representatives Speaker Paul Ryan, who managed to keep fiscal hawks in his Republican caucus under control during weeks of talks and avoid the kind of infighting that plagued his predecessor, John Boehner.

Obama gave Ryan's efforts a nod during a White House news conference.

"Kudos to him as well," Obama said, along with "all the leaders and appropriators who were involved in this process."

The Democratic president acknowledged he still had basic policy differences with Ryan but described "a good working relationship" between the two.

At more than 2,000 pages long, the spending portion of the bill funds the government through next September, preventing a shutdown and effectively taking difficult budget disputes off the table as the 2016 presidential campaign enters the primary season.

Most of the U.S. senators running for the White House voted against the bill, including Republicans Ted Cruz and Rand Paul and Democrat Bernie Sanders. Republican Lindsey Graham voted in favor. Republican Senator Marco Rubio, who had been criticized by campaign rivals for missing votes, was absent from Congress on Friday.

Story continues

Dozens of previously temporary tax breaks will now be permanent under the tax segment of the bill, which will cost $680 billion over 10 years and was promoted by corporate lobbyists and low-tax Republicans.

Middle-class Americans also gain. Students, low-income parents and teachers will receive tax aid, attracting support for the legislation from the White House and congressional Democrats.

Lawmakers also lifted a four-decade-old ban on U.S. crude oil exports, a historic move that nevertheless will have little immediate effect on oil markets.

"I'm not wild about everything in it," Obama said of the legislation. "I'm sure that's true for everybody. But it is a budget that, as I insisted, invests in our military and our middle class without ideological provisions that would have weakened Wall Street reform or rules on big polluters."

DEFICIT WORRIES

Some Republicans worry that the $1.15 trillion spending provisions add to the federal budget deficit and erode the fiscal discipline that House Republicans have championed, particularly since lawmakers aligned with the conservative Tea Party movement did well in 2010 congressional elections.

But Tea Party momentum has slowed as the federal deficit drops from its peak of $1.41 trillion in 2009 due to the economic recovery. The deficit was $439 billion for the fiscal year that ended on Sept. 30.

The congressional Joint Committee on Taxation estimates the legislation passed on Friday will increase the 2016 fiscal year budget deficit by $157 billion and by $95 billion in 2017.

Tim Huelskamp of Kansas, a leading House Republican fiscal hawk, said the bill was “an early Christmas present for Donald Trump," the billionaire businessman seeking the Republican presidential nomination, because it will fuel the anti-establishment mood in the country.

Conservatives complained that Republican leaders agreed on the bill's spending and tax provisions behind closed doors and then rushed the bill through the Senate on Friday morning.

"A rotten process yields a rotten result, and this 2,000-page, trillion-dollar bill is rotten to its core," Republican Senator Tom Cotton of Arkansas said. "Corporate lobbyists had a field day, but working Americans lost out," Cotton said.

Some Democrats criticized the tax cuts, saying they give more aid to large corporations and wealthy business owners than to working families.

The largest component of the tax package is the business research and development tax credit, which will cost $113 billion over a decade in lost government revenues.

The bill ratifies International Monetary Fund reforms aimed at boosting the representation of emerging economies within the international lender.

(Additional reporting by Susan Heavey and David Lawder; Writing by Alistair Bell; Editing by Bill Trott and Will Dunham)