(Reuters) - President Barack Obama on Tuesday signed a $1.1 trillion spending bill passed by Congress last week that lifted the threat of a government shutdown.

The legislation funds most government agencies through September 2015. The Department of Homeland Security will be treated differently, getting a funding extension only through Feb. 27, by which time Republicans will control both chambers of Congress.

Passage of the 1,603-page bill was a long struggle in the Senate and the House of Representatives marked by bitter disputes over changes to banking regulations and Obama's recent executive order on immigration.