The House voted 357-60 in favor of the short-term bill after it had been passed in the Senate.
President Barack Obama, who said he would back a short-term deal to avert a shutdown, signed it shortly afterwards.
It ensures the department’s 250,000 employees will be paid while a longer-term funding agreement is discussed.
The two-thirds majority vote was reached about two hours before the midnight deadline.
Earlier, Republicans had rejected a similar three-week extension after provisions against President Barack Obama’s immigration plan were dropped.
The one-week deal was backed by a majority of Democrats despite many of them voting against the earlier bill in the hope that a longer-term deal could be agreed.
The move came shortly after President Barack Obama had spoken by phone to Democratic leaders in a bid to avert the partial department closure.
The Department of Homeland Security is responsible for securing US borders, airports and coastal waters.
About 200,000 “essential” department employees would have continued to work without pay if the agency’s funding had not been secured.
Some Republicans had wanted to use the funding of the department, which includes immigration officials, as a bargaining chip to force President Barack Obama to end policies on immigration.
In November 2014, Barack Obama used his executive powers to protect about five million undocumented immigrants from deportation. Republicans say President Barack Obama overstepped his powers in doing so.
A separate ruling by a federal judge has blocked those policies from starting while a lawsuit by more than two dozen states goes forward.
Some Republicans senators had expressed a desire to fight the executive actions in the courts, rather than threaten the department’s funding.
On February 26, Homeland Security Secretary Jeh Johnson urged Congress to pass full funding.
“A short-term continuing resolution exacerbates the uncertainty for my workforce and puts us back in the same position, on the brink of a shutdown just days from now,” Jeh Johnson said.
Last week, the White House said President Barack Obama would prefer a full funding bill but would sign a short-term measure to prevent a shutdown.
d4lS-LI9wXYQuincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…
Misleading allegations, rumours and outright lies about voting and fraud are flooding online spaces in…
At least 158 people have died in Spain's worst flooding disaster in generations. On October…
Google has been fined two undecillion (a two followed by 36 zeroes) roubles by a…
Embarking on a home remodel is an exciting journey, promising enhanced comfort, increased property value,…
The US presidential candidates continued to campaign across key swing states on October 20. Footage…