The decision, the first from the high court to review Trump's exercise of presidential power, allowed much of the ban to take effect, but it also applied significant restrictions that will narrow the order's impact.
In a short, unsigned but unanimous opinion, the justices avoided taking a stance on the larger constitutional questions concerning religious discrimination or presidential authority. Instead, they agreed to hear those arguments in the fall.
But they also largely rejected the lower court rulings that had blocked Trump's order as unconstitutional, handing a partial victory to the president and his lawyers after a string of rebukes in federal courts from Hawaii to Maryland.
The ruling clears the way for Trump's 90-day ban on foreign arrivals from six Muslim-majority countries to take effect, but it also carved out exemptions for those with "bona fide relationships" with Americans or U.S. entities, including spouses, other close family members, employers and universities.
The justices also strongly hinted that they may never need to settle the larger constitutional issues because the case could be moot by the time they hear it in the fall.
The administration argued it needed the 90-day pause to review and revise its vetting procedures for travelers from Iran, Somalia, Sudan, Syria, Libya and Yemen. Assuming the order takes effect now, the ban will have expired by October when the court reconvenes.
Trump had long voiced confidence he would prevail when the travel ban case reached the high court and on Monday he called the decision a "clear victory" for his administration.
"Today's ruling allows me to use an important tool for protecting our nation's homeland," the president said.
The administration did not provide immediate specifics on how the decision would change existing policy, leaving attorneys at the
Trump officials also acknowledged that their optimism may be subject to change, depending on how far the government's lawyers are willing to push the ruling and how lower courts interpret the high court's language.
That caution contrasted with the administration's earlier handling of the issue, when Trump signed a hastily drafted travel ban just days after taking office. The result was a chaotic execution, with uncertainty at airports around the world over who would be allowed to enter the country.
Immigrant rights lawyers who sued to block Trump's order were disappointed with Monday's ruling, but downplayed its impact.
The order "will take effect in a very limited way," said Karen Tumlin, legal director for the National Immigration Law Center in Los Angeles. The ban will apply "only to a small subset of people who lack any relationship" with a person in this country or an institution such as a school or a hospital.
Some welcomed what they described as an implicit rebuke of the White House's assertion that Trump has unfettered powers to exclude arrivals based on purported national security concerns.
But others worried about the message it may send. It "ignores the anti-Muslim bigotry that is at the heart of the travel ban executive orders and will inevitably embolden Islamphobes in the administration," said Nihad Awad, executive director of the Council on American-Islamic Relations.
David Miliband, president of the International Rescue Committee, said the partial reinstatement of the ban particularly threatens "vulnerable people waiting to come to the U.S.," including those with urgent medical conditions.
All nine justices apparently agreed with the outcome Monday. Three of the court's conservatives — Justices Clarence Thomas, Samuel A. Alito Jr. and Neil M. Gorsuch — said they would have gone further and allowed the entire order to take effect immediately.
Under the compromise crafted by the court,"foreign nationals who have a credible claim of a bona fide relationship with a person or entity in the United States" are exempted from the ban.
"The students from the designated countries who have been admitted to the University of Hawaii have such a relationship with an American entity," the court said. "So too would a worker who accepted an offer of employment from an American company or a lecturer invited to address an American audience."
Since many visitors from the six affected countries have such a relationship, the impact of the order may be narrow.
But in his dissent, Thomas predicted the court's approach would fail and lead to a "flood of litigation" to determine which visitors are exempt.
"I fear that the court's remedy will prove unworkable," Thomas said. "Today's compromise will burden executive officials with the task of deciding — on peril of contempt — whether individuals from the six affected countries who wish to enter the United States have a sufficient connection to a person or entity in this country."
Last month, the 4th Circuit Court of Appeals in Virginia upheld a district judge's ruling in Maryland blocking Trump's order. The appeals court, in a 10-3 decision, said the executive order reflected an unconstitutional discrimination based on religion. Its opinion cited Trump's campaign pledge to enact a "Muslim ban."
Shortly afterward, the 9th Circuit Court in California upheld a district judge's ruling in Hawaii and ruled Trump's order was illegal because the president did not demonstrate a threat to national security.
Trump's lawyers argued both decisions were fundamentally mistaken. They said the Constitution and immigration laws give the president the power to temporarily "suspend" the entry of foreigners, either individuals or groups. And they argued that the high court has made clear judges have no authority to "second-guess" the president's determination that national security was in danger.
Without hearing arguments in the two cases, the justices agreed the lower courts had gone too far. The outcome suggests that many of the justices were as troubled by the bold intervention of the judges who blocked Trump's order as they were by the bold action of the new president.
The court's opinion noted the government is free to work on the new vetting procedures for immigrants from the six countries. This was the ostensible purpose of the order in the first place.
"We fully expect that the relief we grant today will permit the executive to conclude its internal work and provide adequate notice to foreign governments within the 90-day life of Sec. 2c," the court said, referring to the key clause in the travel ban order.
The case decided Monday was named Trump vs. International Refugee Assistance Project and Trump vs. Hawaii.
On Twitter: DavidGSavage
4:35 p.m.: This article was updated with additional reaction and background.
10:50 a.m.: This article was updated with more reaction and analysis.
9:15 a.m.: This article was updated with Trump's statement.
7:45 a.m.: This article was updated with more details from the ruling.