Leclerc, 21, who had started from pole position and finished third, had been set to become Ferrari's youngest winner in just his second race for the Italian team when his car started losing power.
Hamilton and teammate Valtteri Bottas, both as much as four seconds a lap faster than the stricken Ferrari, reeled him in and breezed past to secure the team's second one-two finish in as many races.
"That was extremely unfortunate for Charles," said Hamilton as he crossed the line, with the race finishing behind the safety car which was deployed to clear away Daniel Ricciardo's stranded Renault.
"He drove such a great race. We've got work to do to keep these guys off our tails," added the Briton, who hugged Leclerc after they stepped out of their cars.
Leclerc's problems capped an already difficult day for Ferrari, who had swept the front row in qualifying, with Sebastian Vettel's race having already unravelled.
The German, who finished fifth, spun while defending second place from Hamilton and then lost his front wing in a spectacular shower of sparks.
The only consolation for Leclerc, on the podium for the first time in his F1 career, was an extra point for setting the fastest lap of the race.
"It's a very hard one to take," said the youngster. "It's a shame to only finish third, but it's part of racing and we'll come back stronger."
The Briton stayed second in the championship but is now just one point shy of overall leader Bottas, who won and scored the extra point for fastest lap in Australia.
Max Verstappen finished fourth for Red Bull ahead of Vettel.
British rookie Lando Norris put in a fine drive for McLaren to finish sixth ahead of Alfa Romeo's Kimi Raikkonen, Leclerc's predecessor at Ferrari.
Hamilton is now 17 wins short of Michael Schumacher's all-time record of 91.