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-LI9wXYThe US House Ethics Committee has voted to release its report on former Republican Representative…
ABC News has agreed to pay $15 million to President-elect Donald Trump to settle a…
South Korea’s parliament has voted to impeach President Yoon Suk Yeol over his failed attempt…
Israeli war planes have carried out more than 100 air strikes in Syria on December…
President-elect Donald Trump has threatened to impose 100% tariffs on the BRICS countries if they…
Syrian troops have withdrawn from the city of Aleppo following an offensive by rebels opposed…