Judge Robert Gerber of the U.S. bankruptcy court in Manhattan said the sale would "prevent the death of the patient on the operating table."
Gerber issued a four-day stay of the order approving the sale, which should allow it to close as early as Thursday. Such stays are typical and allow for possible appeals.
Under the deal, 'New GM' will operate the best parts of the old company, including its Chevrolet and Cadillac brands, with a less expensive workforce, smaller dealer network, and much less debt. The rest of the company will be liquidated.
The sale marks the second big victory for the Obama administration's auto task force. It helped broker the disposal of Chrysler LLC to a group led by Italy's Fiat SpA last month.
GM, which filed for bankruptcy protection on June 1, had argued that it would be forced to liquidate if the sale was not approved, and the U.S. government said it could walk away from funding the automaker if a deal was not approved by July 10.
"GM cannot survive with its continuing losses ... and without the governmental funding that will expire in a matter of days," Gerber wrote in the 95-page opinion.
The judge rejected claims from a group of bondholders that GM could have restructured itself under a more traditional Chapter 11 reorganization plan, in which creditors would have been able to vote.
"As nobody can seriously dispute, the only alternative to an immediate sale is liquidation - a disastrous result for GM's creditors, its employees, the suppliers who depend on GM for their own existence, and the communities in which GM operates," Gerber wrote.
"In the event of a liquidation, creditors now trying to increase their incremental recoveries would get nothing."
Gerber also shot down objections to GM's sale from dealers whose contracts are being terminated, groups of consumer and asbestos claimants that argued they will now be unable to sue GM for their injuries, as well as a group that calls itself the "Unofficial Committee of Family & Dissident GM Bondholders."
He rejected arguments that the U.S. government, which has loaned GM billions of dollars before and during the bankruptcy, had been overbearing in its negotiations to restructure the automaker.
"The U.S. Treasury, in making hard decisions about where to spend its money and make New GM as viable as possible, made business decisions that it was entitled to make," Gerber wrote.
The 'old GM', which includes unpopular brands and unneeded factories and liabilities, will remain behind in bankruptcy court to be liquidated.
The U.S. Treasury has agreed to provide $60 billion in financing to the new company, including a proposed $50 billion giving it a 60 percent stake in the company.
The UAW would gain a 17.5 percent stake, the Canadian government about 12 percent and GM bondholders about 10 percent of the new company.
At a three-day sale hearing that concluded July 2, some small bondholders had objected to the deal, but no bidders presented an alternative, and the 100-year-old automaker warned of "catastrophic" consequences to the auto industry if the sale was blocked.
An auto task force official said earlier this month that the government could conduct an initial public offering for the "New GM" as soon as 2010.
The case is In re: General Motors Corp, U.S. Bankruptcy Court, Southern District of New York, No. 09-50026.