"On Sept. 11, 2001, enemies of freedom made our country a battleground," he said. "Their method is the mass murder of the innocent and their goal is to make all Americans live in fear.
"And yet our nation refuses to live in fear," he said. "The best way to overcome fear and to frustrate the plans of our enemies is to be prepared and resolute at home and take the offensive abroad."
Mr. Bush went to the department's headquarters to sign the bill at a ceremony under a blue banner reading, "Protecting the Homeland."
The bill that Congress sent to Mr. Bush was about $1 billion above what the president requested. It includes some $4.2 billion for first-responder programs, $9 billion for border protection and $5.2 billion for the Transportation Security Agency and the Federal Air Marshal Program.
Recalling the attacks two years ago, Mr. Bush said the nation does not live in the past but still grieves over the thousands of victims.
"We will do everything in our power to prevent another attack on the American people," the president said. "And wherever America's enemies plot and plan, we'll find them and we will bring them to justice."
The House passed the bill 417-8. Despite the overwhelming vote, House Democrats complained that the administration was shortchanging domestic security while it was seeking $87 billion in emergency money for military and rebuilding efforts in Iraq and Afghanistan.
The Senate passed the bill, 93-1, on a voice vote. Only Sen. Ernest Hollings, D-S.C., who said the measure lacked sufficient funds for ports, voted no. The one-sided vote illustrated lawmakers' reluctance to vote against a bill for domestic security.
Before the final vote, Democrats unsuccessfully tried to boost spending for emergency responders, ports and other areas. Republicans, citing budget pressures, beat them back.
The bill finances an administration plan to check databases for information on foreigners entering the country, and includes funds Mr. Bush wanted for acquisition of antidotes to counter bioterrorism.
The $4.2 billion for first-responder programs goes to state and local governments, with $750 million for cities thought to face high threats of terror attacks. In two votes that divided senators from rural and urban states, the Senate refused to bolster the funds for high-threat areas.