Federer gave Switzerland a 1-0 lead in the tie with a 6-4, 6-2 win over world No.4 Alexander Zverev, AAP reported.
But Angelique Kerber leveled the tie with a 6-4, 7-6 (8-6) win over Belinda Bencic in the women's singles rubber.
Switzerland then came up trumps 4-0, 1-4, 4-3 (5-4) in the deciding mixed doubles that came down to the final point.
Under the short-sets format, the match is decided by a winner-takes-all point if scores are locked at 4-4 in the third-set tiebreak.
Germany blew a championship point before it reached that stage, and it again faltered when everything was on the line, with Zverev hitting the ball into the net to spark Switzerland's celebrations.
Federer's three Hopman Cup titles is more than any other player.
The 20-time Grand Slam champion first won the Hopman Cup in 2001, when he teamed with Martina Hingis to beat the US.
The 37-year-old won his second crown alongside Bencic last year, beating Zverev and Kerber.
And it was the exact same script this year, with Federer winning his singles match in the final before helping clinch the deciding rubber in the mixed doubles.
Federer was simply irresistible in his singles match, countering the power of Zverev with classy stroke play and unpredictable deftness.
Federer beat Frances Tiafoe, Stefanos Tsitsipas, Cameron Norrie, and Zverev in straight sets at the Hopman Cup, giving him an excellent preparation for his Australian Open title defense.
"I'm happy I'm feeling this good and playing as well as I am," Federer said. "It's good to finish on a singles performance like this. I'm a bit surprised that the matches have gone as well as they have."
Saturday's final took on extra significance given there's a strong chance it could be the last ever Hopman Cup.
A new ATP World Team Cup tournament is set to be introduced in Australia next year.
The Hopman Cup, which was first held 30 years ago, is almost certain to be axed to make way for the incoming 24-team tournament, which is set to be hosted in Sydney, Brisbane, and Perth.