WASHINGTON (CNN) -- After months of stalemate, the Senate late Tuesday passed a huge government spending bill that includes billions of dollars requested by President Bush to continue the war in Iraq.

White House officials have said President Bush would sign off on the spending plan if the Iraq money was added.

The roughly $555 billion bill -- which passed 76-17 -- also preserves thousands of earmarks for lawmakers who will deliver them to constituents just in time for the holidays.

The final vote came at about 11 p.m. ET Tuesday -- after hours of debate that included two more attempts by Senate Democrats to tie war funding to a plan to withdraw U.S. troops from Iraq.

Those efforts failed, as have dozens of others in the House and Senate since Democrats took control of Congress last year.

Earlier, members voted to add $40 billion for the war in Iraq that had been removed by the House -- which passed the spending bill on Monday. The plan also includes $30 billion for troops in Afghanistan.

Sen. Joe Lieberman, an independent from Connecticut who co-sponsored the push to reinstate the Iraq money, called its approval "a very powerful bipartisan message of support for our men and women serving in Iraq."

White House officials have said Bush would sign the spending plan if the Iraq money was added. In the weeks leading up to the vote, Bush had repeatedly pushed members of Congress to approve a military spending bill that did not place troop-withdrawal requirements on the military in Iraq.

The bill wraps together 11 of the 12 government spending bills for 2008 -- except for that of the Department of Defense, which was already funded.

Facing a president determined to keep spending in check and a unified Republican minority in the House and Senate, Democrats have been stymied at nearly every turn in their attempts to increase spending on their domestic priorities.

Fearing a politically dangerous government shutdown, Democratic leaders ultimately gave in to Bush's top line number and trimmed $22 billion from the measure.

But Democrats stemmed their losses somewhat by shifting some funding from the president's priorities to their own. And they added billions more above Bush's top line in "emergency" funding for veterans health care, California fires, border security and more.

The government spending watchdog group Taxpayers for Common Sense, which scrambled Monday to pore over the nearly 1,500-page bill that was made public late Sunday night, said it has identified almost 9,000 earmarks worth $7.4 billion.

Many of the earmarks avoided normal congressional scrutiny and were "airdropped" -- or slipped in without going through normal committee consideration -- into the final bill, the group said.

But Sen. Robert Byrd, D-West Virginia, chairman of the budget-writing appropriations committee, said the spending plan represents a dramatic decrease in pork-barrel projects from the one approved by Bush two years ago -- when Republicans controlled Congress.

"The total dollars that are earmarked is reduced -- hear me now -- by 43 percent," Byrd said Tuesday from the Senate floor. "That ain't chicken feed."

Arguing for a plan that would have begun pulling troops from Iraq within 90 days, Sen. Edward Kennedy, D-Massachusetts, became emotional as he called the Bush administration's efforts in Iraq "a continuing quagmire."

"The best way to end this charade and protect our troops and our national security is to put the Iraqis on notice that they need to take responsibility for their future," Kennedy said.

"Unless there's a binding timeline for the redeployment of our troops, the Iraqis will not feel the need to make the compromises essential for a political solution."

The measure now goes back to the House for approval in its revised form.

House Speaker Nancy Pelosi said she expects the bill to pass the House, although she will vote against it because of the war funds added in the Senate version. E-mail to a friend

CNN's Ted Barrett contributed to this report.

All About George W. Bush • Iraq War • U.S. Congress