"Even well-intentioned laws must pass constitutional muster," Appellate Judge Kenneth Lee wrote for the panel's majority. California's ban on magazines holding more than 10 bullets "strikes at the core of the Second Amendment - the right to armed self-defense."
He noted that California passed the law "in the wake of heart-wrenching and highly publicized mass shootings," but said that isn't enough to justify a ban whose scope "is so sweeping that half of all magazines in America are now unlawful to own in California."
California Attorney General Xavier Becerra did not immediately say if he would ask the full appellate court to reconsider the ruling by the three judges, or if he would appeal to the U.S. Supreme Court.
Teen arrested for threat of mass shooting at South L.A. middle school; AR-15 rifle, ammunition seized
He also did not immediately say if the state would seek a delay of the ruling to prevent an immediate buying spree. Sales are currently on hold based on a stay by the lower court and cannot immediately resume.
California Rifle & Pistol Association attorney Chuck Michel called it "a huge victory" for gun owners "and the right to choose to own a firearm to defend your family."
The ruling has national implications because other states have similar restrictions, though it immediately applies only to Western states under the appeals court's jurisdiction.
It was a fractured decision: Two of the three judges voted to toss out the state's ban, while the third judge dissented.
U.S. District Court Judge Barbara Lynn of Texas, who had been named the third judge on the appellate panel, said the majority's ruling conflicts with decisions in six other district courts across the nation.
Gun rights groups have been trying to get such cases before the nation's high court now that it has a more conservative majority.
Friday's decision upholds a 2017 ruling by San Diego-based U.S. District Judge Roger Benitez, who blocked a new law that would have barred gun owners from possessing magazines holding more than 10 bullets.
But he and the appeals court went further by declaring unconstitutional a state law that had prohibited buying or selling such magazines since 2000. That law had let those who had the magazines before then keep them, but barred new sales or imports.