The decision by Judge Derrick Watson was a victory for opponents of the ban, which the Trump administration says is necessary to keep out terrorists.
The US Supreme Court had allowed part of the ban to go into effect on June 30, putting an end, at least temporarily, to five months of skirmishes in lower courts.
Specifically, the court allowed a 90-day ban on visitors from Iran, Libya, Somalia, Sudan, Syria and Yemen, and a 120-day ban on refugees, with exceptions for people with "close family relationships" in the United States.
The Donald Trump administration defined "close family relationship" to include parents, spouses, children, fiancees and siblings.
But Watson found that "the Government's narrowly defined list finds no support in the careful language of the Supreme Court or even in the immigration statutes on which the Government relies."
"Common sense, for instance, dictates that close family members be defined to include grandparents," he wrote.
"Indeed, grandparents are the epitome of close family members. The Government's definition excludes them. That simply cannot be."
Watson ordered Homeland Security and the State Department not to enforce the ban on "grandparents, grandchildren, brothers-in-law, sisters-in-law, aunts, uncles, nieces, nephews, and cousins of persons in the United States."