The $94.5 billion compromise was easily passed by the Senate, with a vote of 98-1. The funding was passed by the US House of Representatives on Tuesday.
The bill will now be signed into law by George Bush, the president, and $65.8 billion will be sent to the Pentagon so it can continue the wars in Iraq and Afghanistan until the end of September.
Congress will soon vote on separate legislation which will allocate $50 billion more to keep combat operations running from October until about March.
Yesterday the Senate unanimously warned the Bush administration to improve its budget planning due to the Iraq war, the cost of which is nearing $320 billion.
"I'm frustrated the administration keeps funding this war off-budget, said Senator Patty Murray, a Washington Democrat, just before passage of the compromise.
Congress has overwhelmingly supported the emergency spending bills for troops fighting abroad but there is growing dissent over how long the US military presence should be maintained in Iraq. The conflict has killed 2,500 American troops and tens of thousands of Iraqi civilians.
The $19.8 billion from the emergency bill will be used to help Louisiana, Mississippi, Alabama and other states still recovering from Hurricane Katrina and other storms. A large part of the money will go to rebuilding the levees and other infrastructure around New Orleans which were overwhelmed by Katrina.
New Orleans will get funds to
rebuild after Hurricane Katrina
About $4 billion in additional foreign aid, much of it for Iraq, is provided in the bill.
US border security will be increased with additional money to dispatch National Guard troops and hire more agents to patrol the southwestern border. Critics said $1.9 billion instead should have been spent buying new equipment for existing agents.
The bill also included $2.3 billion Bush requested to prepare for a possible avian flu pandemic.
Bowing to a Bush veto threat, the compromise bill had $14.4 billion less in funds than the legislation originally passed by the Senate. Negotiators dumped a long list of projects, including about $3.5 billion in disaster aid for farmers outside the hurricane area, some Mississippi projects and some funds for veterans.
House-Senate negotiators also restored $47 million in foreign aid to Egypt that the Senate had voted in May to cut. The aid had been cut due to concerns over Egypt's crackdown on political dissent. The plan had been to give that money to Uganda, Kenya, Ethiopia and possibly Somalia for famine and disaster relief.