President Donald Trump quickly moved to blame Democrats for the bill's failure.
"Tonight, they put politics above our national security, military families, vulnerable children, and our country's ability to serve all Americans," the White House said in a statement.
The White House also said it won't discuss immigration until the government was up and running again.
"We will not negotiate the status of unlawful immigrants while Democrats hold our lawful citizens hostage over their reckless demands. This is the behavior of obstructionist losers, not legislators," the statement said.
In return, Senate Minority Leader Chuck Schumer, D-NY, pointed the finger directly at Trump.
"The blame should crash entirely on President Trump's shoulders," Schumer said early Saturday.
Democrats had been holding out for a deal on a resolution to the fate of so-called Dreamers, undocumented people who immigrated to the United States as children. Only five Democrats supported the latest stopgap funding bill, down from 45 who voted in favor of the first such measure in September.
Yet, four Republicans, including Lindsey Graham of South Carolina and Mike Lee of Utah, opposed the bill. Senate Majority Leader Mitch McConnell also voted against the bill, albeit for procedural reasons so he could bring the vote up again.
Lee, a fiscal conservative, voted down each of the previous temporary spending bills. Kentucky Sen. Rand Paul also opposed the measure over budget concerns, saying the proposed measure would exceed spending caps Congress enacted in 2011 to keep expenses under control.
Republican Sen. John McCain of Arizona, who is undergoing cancer treatment, was the only senator not to vote.