Derrick Watson, a US district judge in Hawaii, ordered the temporary stay just hours before Mr Trump’s action was due to come into effect at midnight. The nationwide ruling means that people should not be impacted by the order.
At a rally in Nashville President Trump called the move by the judge was an "unprecedented judicial overreach" and said he was ready to take the case "as far as it needs to go" including to the Supreme Court.
"A judge has just blocked our executive order on travel and refugees coming into our country from certain countries", Mr Trump said.
"The order he blocked was a watered-down version of the first order that was also blocked by another judge and that should never have been blocked to start with …
"This is, in the opinion of many, an unprecedented judicial overreach," he added.
Judge Watson was one of three federal judges across the US that listened to legal arguments on Wednesday. Up to half-a-dozen states are seeking to block the executive order and judges in Maryland and the state of Washington also heard cases.
Mr Trump had issued a revised travel ban after his first sparked international protests and suffered several legal setbacks from courts who judged it unconstitutional. He hoped the new order, which did not involve green card holders and which removed any reference to religion, would be legally more watertight.
But activists said the new ban still discriminated, both on the grounds of nationality and indeed religion.
Lawyers for the ACLU and other groups, said that Mr Trump’s statements on the campaign trail during the 2016 election, and from his advisers since he took office, made clear the intention was to block Muslims.
The island state of Hawaii, which has a Democratic governor and legislative assembly, had argued that Mr Trump’s revised order discriminated on the grounds of nationality, and would prevent Hawaii residents from receiving visits from relatives in the six countries named in the ban. It also said the order would harm its crucial tourism industry, and the ability to recruit foreign students and workers.
The lawsuit also argued that the order discriminated against Muslims in violation of the US Constitution. Judge Watson concluded in his ruling that while the order did not mention Islam by name, “a reasonable, objective observer ... would conclude that the Executive Order was issued with a purpose to disfavour a particular religion.” Judge Watson was appointed to the bench by former Democratic President Barack Obama.
The judge also cited “questionable evidence supporting the government's national security motivation” adding in his 43-page ruling that Hawaii would suffer financially if the executive order goes into effect and blocks the flow of students and tourists to the state.
The judge also said Hawaii is likely to succeed on a claim that the ban violates the First Amendment right protecting people against religious discrimination.
Mr Trump's first travel order was more sweeping than the second revised order. Like the current one, it barred citizens of Iran, Libya, Syria, Somalia, Sudan and Yemen from entering the country for 90 days, but it also included Iraq, which was subsequently taken off the list.
Refugees were blocked from entering the country for 120 days in both orders, but an indefinite ban on all refugees from Syria was dropped in the new one.
The revised ban also excluded legal permanent residents and existing visa holders. It provided a series of waivers for various categories of immigrants with ties to the United States.
The Associated Press said that a group of 58 tech companies, including Airbnb, Lyft and Dropbox, filed a “friend of the court' brief in the Hawaii case saying the order hurt their ability to recruit the best talent from around the world.
Judge: Reasonable person would conclude Trump's ban "was issued with a purpose to disfavor a particular religion" despite its stated purpose pic.twitter.com/S4JcgbjiGj— Bradd Jaffy (@BraddJaffy) March 15, 2017
A longer list of companies, which included giants such as Apple, Facebook and Google, filed a brief opposing the first ban in a different court challenge brought by Washington state, which is ongoing.
During the election campaign, Mr Trump had promised to tighten immigration regulations.
While his original order, signed on January 27, was considered racist and counter-productive by many, large number of the president’s supporters backed the move.
On Wednesday night, Mr Trump’s spokesman, Sean Spicer, did not immediately respond to questions from reporters about the court decision.
The Department of Justice called the ruling “flawed both in reasoning and in scope,” adding that the president has broad authority in national security matters. “The Department will continue to defend this Executive Order in the courts,” it said a statement.
The case in Hawaii was one of several that were under motion on Wednesday, after more than half-a-dozen states, including Washington, Oregon, California and New York, said they were going to try and stop Mr Trump’s revised order, which he signed on March 6.
In Maryland, lawyers told a federal judge that the measure still discriminated against Muslims. Government officials, in turn, argued that the ban had been evised to remove an exemption for religious minorities from the affected countries.
“It doesn’t say anything about religion. It doesn’t draw any religious distinctions,” said Jeffrey Wall, who argued for the Department of Justice.
In Washington state, US District Judge James Robart, who halted the original ban last month, heard arguments in a lawsuit brought by the Northwest Immigrant Rights Project.
Washington state’s Attorney General, Bob Ferguson, was at the hearing in Seattle, when he was told of the decision of the judge in Hawaii.
“Fantastic news,” Mr Ferguson said afterwards. “It’s very exciting. At this point it's a team effort - multiple lawsuits and multiple states.’
If the Trump administration seeks an emergency stay of Judge Watson's decision in Hawaii at the 9th Circuit, the matter would be heard by different judges from the three who ruled on the travel ban case last month. That's because the panel of judges assigned to such cases rotates every month, said court spokesman David Madden.
Also on Wednesday, the 9th Circuit declined to reconsider the 3-0 decision not to reinstate the original ban. In a dissent, five judges said they considered that decision incorrect and wanted it vacated.
“Whatever we, as individuals, may feel about the president or the executive order, the president's decision was well within the powers of the presidency,” Judge Jay Bybee wrote for the five.