A compromise spending bill to keep the government funded for the rest of the fiscal year won approval Friday from the House of Representatives, the first step toward averting a partial government shutdown at midnight.