A small but critical group of Democrats backed legislation to fund the government, providing the votes to move forward with a spending package that would end the shutdown in coming days.