A more comprehensive ban remains scheduled for November, about a week after the presidential election.
The judge, Carl Nichols of the US District Court for the District of Columbia, did not agree to postpone the later ban.
The ruling followed an emergency hearing on Sunday morning in which lawyers for TikTok argued that the administration’s app store ban would infringe on the company’s First Amendment rights and do irreparable harm to the business.
Earlier this year, US President Donald Trump declared that TikTok was a threat to national security and that it must either sell its US operations to US companies or be barred from the country.
TikTok, owned by Chinese company ByteDance, is scrambling to firm up a deal tentatively struck a week ago in which it would partner with Oracle, a huge database-software company, and Walmart in an effort to win the blessing of both the Chinese and American governments.
In the meantime, it is fighting to keep the app available in the US.
Judge Nichols did not explain his reasoning publicly, instead filing his judicial opinion under seal.
Initially, both the US government’s brief in the case and the entire Sunday morning hearing were also due to be sealed, although the court later relented.
In arguments to Judge Nichols, TikTok lawyer John Hall said that TikTok is more than an app, since it functions as a “modern day version of a town square”.
“If that prohibition goes into effect at midnight, the consequences immediately are grave”, Mr Hall said.
“It would be no different than the government locking the doors to a public forum, roping off that town square”, he added, saying this was a time when a free exchange of ideas is necessary heading into a polarised election.
TikTok lawyers also argued that a ban on the app would affect the ability of tens of thousands of potential viewers and content creators to express themselves every month and would also hurt its ability to hire new talent.
In addition, Mr Hall argued that a ban would prevent existing users from automatically receiving security updates, eroding national security.
Justice Department lawyer Daniel Schwei said Chinese companies are not purely private and are subject to intrusive laws compelling their cooperation with intelligence agencies.
The Justice Department has also argued that economic regulations of this nature generally are not subject to First Amendment scrutiny.
“This is the most immediate national security threat,” said Mr Schwei.
“It is a threat today. It is a risk today and therefore it deserves to be addressed today even while other things are ongoing and playing out.”