Ten Democrats joined with most Republicans to set up a final vote on the six-month spending measure hours out from the shutdown deadline.