The Senate voted to advance a spending bill to fund the government through Sept. 30, narrowly avoiding a government shutdown.