The bill was one of the last measures Congress passed before adjourning in December.
Some Republicans were concerned with how to pay for the bill and they tried to block the measure. But they dropped their opposition after lawmakers struck a compromise to reduce the costs.
The $4.2 billion measure will be paid for with a fee on some foreign companies that get U.S. government procurement contracts.
Mr. Obama signed the bill from Hawaii, where he's vacationing with his family.