The House overwhelmingly approved legislation Tuesday to prevent a government shutdown and keep federal agencies operating beyond Oct. 1.