The 78-12 vote Saturday also lifts a quarter-century ban on oil drilling off the Atlantic and Pacific coasts. That's a big victory for Republicans.
The $634 billion bill also would provide money to keep the government running past the current budget year, which ends Tuesday, and keep domestic agencies at current levels until March - effectively punting their budgets to the next president and Congress.
The measure is dominated by $488 billion for the Pentagon, $40 billion for the Homeland Security Department, and $73 billion for veterans' programs and military base construction projects - amounting to about 60 percent of the budget work Congress must pass each year.
The stopgap measure to keep the government in business was needed because the budget process broke down this year. Agencies would be funded through March 6 or until their regular budgets pass.
After hard lobbying, automakers won up to $25 billion in low-interest loans to help them develop technologies and retool factories to meet new standards for cleaner, more fuel-efficient cars.
Republicans say ending the drilling ban should lower gasoline prices. Democrats say it won't mean additional oil production for years.
The budget legislation is the result of months of wrangling between Democrats who control Congress and the lame-duck Bush administration and its allies on Capitol Hill. The administration won approval of the defense budget while Democrats wrested concessions from the White House to obtain $23 billion in disaster aid and $5.1 billion for heating subsidies for the poor.
Smaller spending increases would gear up the Census Bureau for the 2010 count, boost spending for Pell college grants to avoid shortfalls, and fix problems in the Women, Infants and Children program, which delivers healthy foods to the poor.
The lifting of the offshore oil drilling moratorium does not mean drilling is imminent. But it could set the stage for the government to offer leases in some Atlantic federal waters as early as 2011.
The legislation also contains 2,322 pet projects totaling $6.6 billion, according to Taxpayers for Common Sense, a watchdog group. That included 2,025 in the defense portion alone that cost a total of $4.9 billion.