Roberts, who could hold the pivotal vote on the court, aimed his few questions at lawyers representing DACA recipients and their supporters. He did not seriously question the administration's argument.
However, in June the chief justice surprised many observers when he cast the deciding vote to prevent the administration from adding a citizenship question to the 2020 census, despite not voicing much skepticism during arguments in the case.
Some DACA recipients who are part of the lawsuit against Trump's action were in the courtroom for the arguments. Many people camped out in front of the court for days for a chance at some of the few seats available to the general public. Roberts rejected a request to provide live or same-day audio of the arguments. The court will post the audio on its website on Friday.
If the court agrees with the administration in the DACA case, Congress could follow up by putting the program on surer legal footing. But the absence of comprehensive immigration reform from Congress is what prompted Obama to create DACA in 2012, giving people two-year renewable reprieves from the threat of deportation while also allowing them to work.
Federal courts struck down an expansion of DACA and the creation of similar protections for undocumented immigrants whose children are U.S. citizens.
Trump's anti-immigrant rhetoric was a key part of his presidential campaign in 2016, and his administration pointed to the invalidation of the expansion and the threat of a lawsuit against DACA by Texas and other Republican-led states as reasons to bring the program to a halt.
Young immigrants, civil rights groups, universities and Democratic-led cities and states sued to block the administration. They persuaded courts in New York, San Francisco and Washington, D.C., that the administration had been "arbitrary and capricious" in its actions, in violation of a federal law that requires policy changes to be done in an orderly way.
California Attorney General Xavier Becerra called Tuesday an important day for DACA recipients, also known as Dreamers, and for the country.
"It was a fight for the values that have made America the beacon of hope around the world, the place that people wish to come to live out their dreams," Becerra said. "And I believe that nine justices heard why we must continue to have that as our legacy ... I think it also stood out that the actions by the Trump administration were not only unlawful, but were unwise and would be consequential for so many Americans."
KQED's Farida Jhabvala Romero contributed reporting to this post.