Puerto Rico’s attempt to restructure its $74 billion debt dodged a bullet when a judge rejected a hedge-fund creditor’s claim that the government body overseeing the reorganization was unconstitutional.

If Judge Laura T. Swain of the U.S. District Court for the Southern District of New York had agreed with Aurelius Investment LLC, an affiliate of Aurelius Capital Management, the entire bankruptcy-like proceeding could have been rendered null and void. That would’ve put the island territory back to square one, or...