With little fanfare to mark a rare bipartisan achievement, President Barack Obama on Tuesday signed a massive, $1.1 trillion spending bill that keeps the government operating over the next nine months.

The legislation was a compromise that angered liberals and conservatives alike but avoided a government shutdown and put off partisan clashes over immigration to next year.

It was one of the last acts of Congress under the current Republican House and Democratic-controlled Senate. In January, the new Congress will return with Republicans in charge of both chambers.

The measure retains cuts negotiated in previous budget battles and rolls back some banking regulations. But it also retains spending for Obama's health care law and pays for the administration's fight against Ebola.

The Department of Homeland Security, however, will only receive its money through Feb. 27, a condition demanded by Republican leaders to appease critics of Obama's immigration measures. The department oversees the nation's immigration enforcement.

The agreement, negotiated mainly by Senate Democratic leader Harry Reid and House and Senate Republican leaders, was the result of a determined effort by House Speaker John Boehner and Senate Republican leader Mitch McConnell to avoid a government shutdown like the partial one in 2013 that damaged the GOP's standing with the public.

Still, conservatives such as Sen. Ted Cruz of Texas chafed at Boehner's and McConnell's decision not to use the spending bill to challenge or undo Obama's executive actions on immigration, especially ones that aim to shield more than 4 million immigrants from deportation and make them eligible for work permits.

Likewise, liberals complained about a provision that did away with a requirement that large banks spin off their lucrative derivatives business into separate subsidiaries. They also objected to a provision that permits wealthy political donors to increase substantially their contributions to the Democratic and Republican parties.

The opposition from the political left and right added drama and uncertainty to the spending bill last week. Obama made personal calls to lawmakers appealing for their votes.

Meanwhile, Cruz and liberal Massachusetts Sen. Elizabeth Warren captured the spotlight by rallying their respective sides to oppose the legislation, laying bare the kinds of intraparty squabbles that could emerge in any future compromise efforts by Obama and the GOP.