The House on Tuesday voted 257-167 for the measure that Obama is expected to sign. Without action, funding for the department would have expired Friday at midnight.
The outcome was a victory for Obama and Democrats, and a defeat for the GOP strategy of trying to overturn Obama's executive actions on immigration by linking them to funding for Homeland.
Republicans were unable to overcome united opposition from Senate Democrats to their strategy. They also suffered embarrassing internal divisions that left the country within hours of a partial agency shutdown last week.