Federal Judge James Robart ruled against government lawyers' claims that US states did not have the standing to challenge Mr Trump's executive order.
Last week's move by Mr Trump triggered mass protests and has resulted in confusion at US airports.
The State Department says 60,000 visas have since been revoked.
Mr Trump's executive order brought in a suspension of the US Refugee Admissions Programme for 120 days.
There is also an indefinite ban on Syrian refugees. Anyone arriving from Iraq, Syria, Iran, Libya, Somalia, Sudan, and Yemen faces a 90-day visa suspension.
Trump border policy: Who's affected?
The lawsuit against President Trump's ban was initially filed by Washington state, with Minnesota joining later.
Washington State Attorney General Bob Ferguson has described the ban as illegal and unconstitutional, because it discriminates against people on the ground of their religion.
The ruling is a major challenge to the Trump administration, and means that nationals from the seven countries are now able - in theory - to apply for US visas, the BBC's David Willis in Washington DC reports.
The administration can appeal against the verdict.
President Trump has argued that his directive is aimed at protecting America.
He said visas would once again be issued once "the most secure policies" were in place, and denied it was a Muslim ban.
A number of state attorney generals have said the order is unconstitutional. Several federal judges have temporarily halted the deportation of visa holders, but the Seattle ruling is the first to be applicable nationwide.
Courts in at least four other states - Virginia, New York, Massachusetts and Michigan - are hearing cases challenging Mr Trump's executive order.
Earlier on Friday, a judge in Boston declined to extend a temporary ban that prohibited the detention or removal of foreigners legally authorised to come to America.
The ban - which only applied to Massachusetts - is due to expire on 5 February.
A US judge in Seattle has issued a temporary nationwide block on President Donald Trump's ban on travellers from seven mainly Muslim nations.