The judge's temporary restraining order represents a major setback for Trump's action, though the White House said late Friday that it believed the ban to be "lawful and appropriate" and that the US Department of Justice would file an emergency appeal.
Still, just hours after the ruling, US Customs and Border Protection told airlines they could board travelers who had been affected by the ban.
Trump's Jan. 27 order caused chaops at airports across the United States last week as some citizens from Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen were denied entry. Virtually all refugees were also barred, upending the lives of thousands of people who had spent years seeking asylum in the US.
The State Department said Friday that almost 60,000 visas were suspended in the wake of Trump's order; it was not clear Friday night whether that suspension was automatically revoked or what travelers with such visas might confront at U.S. airports.
While a number of lawsuits have been filed over Trump's action, the Washington state lawsuit was the first to test the broad constitutionality of the executive order. Judge James Robart, a George W. Bush appointee, explicitly made his ruling apply across the country, while other judges facing similar cases have so far issued orders concerning only specific individuals.
The challenge in Seattle was brought by the state of Washington and later joined by the state of Minnesota. The judge ruled that the states have legal standing to sue, which could help Democratic attorneys general take on Trump in court on issues beyond immigration.
Washington's case was based on claims that the state had suffered harm from the travel ban, for example students and faculty at state-funded universities being stranded overseas. Amazon.com and Expedia, both based in Washington state, had supported the lawsuit, asserting that the travel restrictions harmed their businesses.
Tech companies, which rely on talent from around the world, have been increasingly outspoken in their opposition to the Trump administration's anti-immigrant policies.
Judge Robart probed a Justice Department lawyer on what he called the "litany of harms" suffered by Washington state's universities, and also questioned the administration's use of the Sept. 11, 2001, attacks on the United States as a justification for the ban.
Robart said no attacks had been carried out on US soil by individuals from the seven countries affected by the travel ban since that assault. For Trump's order to be constitutional, Robart said, it had to be "based in fact, as opposed to fiction."
'Outrageous order'The White House said it would file an appeal as soon as possible.
"At the earliest possible time, the Department of Justice intends to file an emergency stay of this outrageous order and defend the executive order of the president, which we believe is lawful and appropriate," the White House said in a statement.
"The president's order is intended to protect the homeland and he has the constitutional authority and responsibility to protect the American people."
Washington Governor Jay Inslee celebrated the decision as a victory for the state, adding: "No person—not even the president—is above the law."
The judge's decision was welcomed by groups protesting the ban.
"This order demonstrates that federal judges throughout the country are seeing the serious constitutional problems with this order," said Nicholas Espiritu, a staff attorney at the National Immigration Law Center.
Eric Ferrero, Amnesty International USA spokesman, lauded the short-term relief provided by the order but added: "Congress must step in and block this unlawful ban for good."
But the fluid legal situation was illustrated by the fact that Robart's ruling came just hours after a federal judge in Boston declined to extend a temporary restraining order allowing some immigrants into the United States from countries affected by Trump's three-month ban.
A Reuters poll earlier this week indicated that the immigration ban has popular support, with 49 percent of Americans agreeing with the order and 41 percent disagreeing. Some 53 percent of Democrats said they "strongly disagree" with Trump's action while 51 percent of Republicans said they "strongly agree."
At least one company, the ride-hailing giant Uber, was moving quickly Friday night to take advantage of the ruling.
CEO Travis Kalanick, who quit Trump's business advisory council this week in the face of a fierce backlash from Uber customers and the company's many immigrant drivers, said on Twitter: "We have a team of in-house attorneys who've been working night & day to get US resident drivers & stranded families back into country.
"I just chatted with our head of litigation Angela, who's buying a whole bunch of airline tickets ASAP!! #homecoming #fingerscrossed"
4 states in court
The decision in Washington state came at the end of a day of furious legal activity around the country over the immigration ban. The Trump administration has justified its actions on national security grounds, but opponents have labeled it an unconstitutional order targeting people based on religious beliefs.
In Boston, US District Judge Nathan Gorton expressed skepticism during oral arguments about a civil rights group's claim that Trump's order represented religious discrimination, before declining to extend the restraining order.
US District Judge Leonie Brinkema in Alexandria, Virginia, ordered the federal government to give the state a list by Thursday of "all persons who have been denied entry to or removed from the United States."