The U.S. House of Representatives has narrowly passed a plan to cut federal spending by nearly $ 40 billion over the next five years .