Lawmakers voted 339 to 85 to approve the package of spending bills that extends funding for some federal agencies through September.