“I see it as a victory personally for Cesar Vargas, but for immigrants everywhere, particularly for Dreamers, for those whose legal status is not of their own doing and who seek full inclusion in what is only their home, this country,” said Michelle J. Anderson, the dean of the City University of New York School of Law, who taught Mr. Vargas and witnessed the ceremony.

Ms. Anderson added, choking up, “He’s an amazing kid.”

The second youngest of eight children, Mr. Vargas was 5 when he crossed the border from Tijuana to San Diego.

He grew up on Staten Island and graduated from James Madison High School in Brooklyn. After law school, Mr. Vargas passed the New York State bar exam in 2011 on his first try. He applied for admission to the bar in 2012, but was rebuffed by the bar’s Committee on Character and Fitness because of his immigration status. His application was then referred to the Appellate Division of State Supreme Court.

In 2013 he gained temporary protection from deportation as part of President Obama’s program for children who came illegally with a parent and became an activist for immigration reform, founding the Dream Action Coalition.

In June, an appellate panel of the State Supreme Court voted unanimously to grant his bar application, making Mr. Vargas the first immigrant without legal status to be allowed entry into the bar. But there was a problem: He had been arrested in January 2015 while protesting during a political program in Iowa, interrupting Gov. Chris Christie of New Jersey.