Obama, who planned to sign the bill Friday, said the law would protect border states beset by undocumented immigrants and illegal-drug traffickers.
It would "also strengthen our partnership with Mexico in targeting the gangs and criminal organizations that operate on both sides of our shared border," Obama said in a statement.
The bill's chief sponsor, Sen. Charles E. Schumer, D-N.Y., said the measure, which was already approved by the U.S. House of Representatives, would give Obama and Homeland Security Secretary Janet Napolitano "the boots on the ground and the resources necessary to combat the crime and violence."
Through a rarely used procedure to avoid bringing senators back to vote during a summer recess, Schumer and Sen. Ben Cardin, D-Md., were the only senators on the floor for the voice vote, CNN reported.
The bill passed by "unanimous consent," a parliamentary term for a voice vote that doesn't require the return of the entire Senate chamber. Republican leaders agreed to the maneuver.
The bill would fund 1,000 new U.S. Border Patrol agents, 250 additional U.S. Immigration and Customs Enforcement agents and 250 more U.S. Customs and Border Protection officers. It would provide money for new communications equipment and improve the use of unmanned surveillance drones.
Rep. Ann Kirkpatrick, D-Ariz., who appealed to senators Tuesday to come back from recess to vote on the bill, said the measure "was a long time coming."
Sens. John McCain, R-Ariz., and Jon Kyl, R-Ariz., also called for the Senate to be brought back into session to vote on the bill.
The law is to be funded in part by raising fees on personnel companies that bring foreign workers into the United States.
Swim Week Miami Beach 2014 [PHOTOS]