Ms McCormick said the pay package would have been the largest ever for the boss of a listed company.
She said that Tesla failed to prove the pay package, which dates back to 2018, was fair.
A shareholder vote on the payment passed by 75% in June, but Ms McCormick did not agree the pay should be so large despite what she called Tesla’s lawyers’ “creative” arguments.
“Even if a stockholder vote could have a ratifying effect, it could not do so here,” she wrote in her opinion.
The judge also ruled the Tesla shareholder who brought the case against Tesla and Mr Musk should receive $345mn in fees but not the $5.6bn in Tesla shares they asked for.