The unanimous decision means Sergio Garcia, who attended law school and passed the state bar exam while working in a grocery store and on farms, can begin practicing law immediately.
The decision is the latest in a string of legal and legislative victories for people who are living in the country without permission. Other successes include the creation of a path to citizenship for many young people and the granting of drivers licenses in many states.
"This is a bright new day in California history and bodes well for the future," the Coalition for Humane Immigrant Rights of Los Angeles said in a statement.
The court sided with state officials in the case, which pitted them against the White House over a 1996 federal law that bars people who are in the U.S. illegally from receiving professional licenses from government agencies or with the use of public funds, unless state lawmakers vote otherwise.
Bill Hing, a law professor at University of San Francisco, said the court made clear the only reason it granted Garcia's petition is that California recently approved a law authorizing the state to give law licenses to immigrants living in the country illegally, a measure inspired by Garcia's situation. The new law took effect Wednesday.
It was unclear how many people will qualify to practice law under the ruling and whether it will spread to other states. Legislatures and governors in more conservative states such as Alabama and Arizona are likely to be less receptive to the idea.
Garcia, who plans to be a personal injury attorney in his hometown of Chico, said he hoped the ruling would serve as a "beacon of hope" to others in the same situation.
He "can hang up a shingle and be his own company," said Hing, who represented the state bar in the case. "Once he does that, a client can retain him as a lawyer."
But some questions remain unresolved, such as whether Garcia can argue cases in federal court or in other states. Federal law makes it illegal for law firms to hire him.
Chief Justice Tani Cantil-Sakauye, who wrote the opinion, said the new state law removed any barrier to Garcia's quest for a license.
"And there is no other federal statute that purports to preclude a state from granting a license to practice law to an undocumented immigrant," Cantil-Sakauye wrote.
The court also found that Garcia "possesses the requisite good moral character" to be admitted to the state bar.
Garcia arrived in the U.S. as a teenager to pick almonds with his father, who was a permanent legal resident. His father filed a petition in 1994 seeking an immigration visa for his son. It was accepted in 1995, but because of the backlog of visa applications from people from Mexico, Garcia has never received a visa number.
He applied for citizenship in 1994 and is still working toward that goal.
The U.S. Department of Justice argued that Garcia was barred from receiving his law license because the court's entire budget comes from the public treasury, a violation of the federal mandate that no public money be used to grant licenses to people who are in the country without permission.
Assistant U.S. Attorney Daniel Tenney, who argued the case, did not immediately return a call seeking comment.
The Obama administration's position in the case came as a surprise to some, since the White House has shielded from deportation people who were brought to the U.S. illegally as children, graduated from high school and kept a clean criminal record.
At a hearing in September, a majority of the state Supreme Court justices appeared reluctant to grant Garcia the license under current state and federal law, saying it prohibited them from doing so unless the Legislature acted.
Garcia, 36, worked in the fields and at a grocery store before attending community college. He then became a paralegal, went to law school and passed the bar on his first try. His effort to get licensed was supported by state bar officials and California's attorney general, who argued that citizenship is not a requirement to receive a California law license.
Two other similar cases are pending in Florida and New York, and the Obama administration has made it clear it will oppose bar entry to immigrants unless each state's Legislature passes its own laws allowing it, Hing said.
California Attorney General Kamala Harris had supported Garcia's petition, and applauded the court's ruling.
Nick Pacilio, a spokesman for Harris, said California's success "has hinged on the hard work and self-sufficiency of immigrants like Sergio."
Associated Press Writer Elliot Spagat in San Diego contributed to this report.
Copyright 2014 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.