An US court decides a case for which there is no statute nor previous court decision (precedent) which would provide how the case should be decided (resolved). So the court (judge) decides it in own way which the judge believes is "the most fair". This would establish a new precedent (I assume).
Then a new legislation (statute) is passed and it provides that the issue (case) shall be resolved (decided) differently. Does this statute take precedence over (overrule) the previous court precedent?