A federal court approved a $300 million loan for Puerto Rico’s Electric Power Authority that will help the bankrupt utility avoid rationing electricity across the island five months after Hurricane Maria.

U.S. District Court Judge Laura Taylor Swain Feb. 19 allowed the commonwealth to lend the power utility cash as it struggles to restore electricity after the storm destroyed the island’s electrical grid. Puerto Rico last week warned Swain that Prepa, as the utility is known, would need to impose...