The House of Representatives narrowly passed a short-term spending bill to keep the government funded through September.