Critics say the law violates people's privacy by giving law enforcement access to their genetic material even before they are charged or convicted.
Supporters say privacy concerns are outweighed by law enforcement's interest in testing DNA to solve cold cases, identify crime suspects and exonerate the wrongly accused.
A lower court ruled in 2014 in Buza's case that the state Constitution's ban on unreasonable search and seizure prohibited collecting DNA by cheek swab without "independent suspicion, a warrant or even a judicial or grand jury determination of probable cause."
The state's 1st District Court of Appeal in a 3-0 decision said the law unreasonably intrudes on the expectation of privacy of people who are arrested.
A 2013 U.S. Supreme Court ruling, however, upheld a similar Maryland DNA collection law.
The appeals court said the U.S. Supreme Court decision did not apply in Buza's case in part because of significant differences between Maryland's law and California's law.
Maryland's law, for example, allows the DNA of suspects to be tested only after they have been charged with a crime. California's law allows testing even before charges are filed.
The California law also applies to all felony suspects who are arrested regardless of the seriousness of the alleged crime and does not call for the automatic destruction of the DNA sample if the person is cleared.
The California Supreme Court said Monday that Buza's crime was serious, and he never contested that there was probable cause for his arrest.
Whether the U.S. Constitution requires the automatic destruction of DNA samples for those wrongly arrested or exonerated is a question "we must leave for another day, because defendant in this case is neither," the majority said.
"This case involves a defendant who was validly arrested on probable cause to believe he had committed felony arson, and who was promptly charged with (and ultimately convicted of) that offense," the court said.