A federal bankruptcy judge on Wednesday blocked most lawsuits against General Motors over a defective ignition switch that is tied to at least 84 deaths, sparing the automaker billions in claims and handing it a momentous victory as it tries to move past its gravest safety crisis.

Judge Robert E. Gerber of the United State Bankruptcy Court in Manhattan ruled that the liability shield included in the 2009 agreement that lifted G.M. from bankruptcy should be allowed to remain in place, even though the company has acknowledged that many employees knew about the defective switch at the time but failed to alert owners of the cars that they might have a potential claim against the company.

The ruling shuts down not only lawsuits stemming from accidents that took place before July 10, 2009, but also most of the suits seeking economic damages for the loss in value of the defective cars.

Lawyers had estimated that the economic loss claims potentially totaled $7 billion to $10 billion. Economic loss cases will be allowed to go forward, the judge ruled, only if they can be tied solely to actions by the post-bankruptcy company, known as New G.M., and “do not in any way rely on any acts or conduct” by the pre-bankruptcy company.