The judge also cited the "irreparable harm" to Acosta.
"Let's go back to work", Acosta said to reporters after the hearing.
CNN said in a statement on Friday that it "looked forward to a full resolution in the coming days". "Only they would attack the president for not supporting a free press in the midst of him taking 68 questions from 35 different reporters over the course of 1.5 hours including several from the reporter in question".
The email includes a "media accountability survey", which asks supporters if they think the White House was correct in revoking Acosta's press pass.
The pass was suspended last week after a contentious exchange at a Trump press conference in which the president called Acosta "a rude, awful person".
Kelly countered at the time that there was at least some evidence that it was Acosta's behavior, not his viewpoint, that got him in trouble with the White House. We will also further develop rules and processes to ensure fair and orderly press conferences in the future.
The White House said in its legal filing that it has "broad discretion" to restrict media access to the president, disputing the argument that its actions violate the constitution.
Trump did not mention the initial White House line that Acosta, who returned to the press area of the White House today, was barred because he allegedly "placed his hands on" an intern who attempted to take the mic from him during a question.
"The White House has made very clear that they don't like the content of the reporting" by CNN and by Acosta, Boutrous said, asserting that content, and not a breach of decorum, prompted the revocation.
But Ms. Sanders, responding to the ruling Friday, said there must be "decorum at the White House".
The ruling today does not mean the battle between CNN/Acosta and the White House is over.
I offer the clip to you not as an easy opportunity to goof on the panelists, although it is that, but as an insight into how the average person is likely to process this morning's news.
"I instructed my people when they are not treated properly, you have the right to just leave, any time you want", he said. "So we're setting up a certain standard, which is what the court is requesting".
"I have no choice but to apply that precedent here", the judge ruled.
This led to a brief, awkward, and controversial incident which ultimately resulted in Acota's press pass being revoked and CNN's filing a lawsuit against the White House.
Resolving that issue involves a First Amendment ruling, which was not rendered by Kelly.
Trump's administration initially said Acosta was banned for inappropriately touching a White House female intern as he struggled to hold on to a microphone. But reporters must show respect, he said. Just reported that, despite the tremendous success we are having with the economy & all things else, 91% of the Network News about me is negative (Fake).
Mr Acosta was accused of "unacceptable" conduct during a heated news conference with Mr Trump after the midterm elections. "I write the answers", he said.