Federer defeated big-serving American John Isner, 6-1, 6-4, to capture his 101st career title, while Barty overcame former world No. 1 Karolina Pliskova, 7-6, 6-3, at Florida’s Hard Rock Stadium, which hosted the tournament for the first time.
Federer’s win leaves him eight titles shy of matching the men’s all-time mark of 109 set by Jimmy Connors.
After rallying from a set down to beat world No. 46 Radu Albot of Romania in his opening match, the Swiss won his next 12 consecutive sets. He beat world No. 15 Daniil Medvedev of Russia in the Round of 16, US Open finalist and world No. 7 Kevin Anderson in the quarters, No. 23 Denis Shapovalov in the semis and defending champion and world No. 9 John Isner in the championship match.
It brings to an end a successful, if somewhat abridged, hard-court season for Federer, who won 19 of 21 matches and will now travel to Europe for the clay-court swing and short grass-court season.
Federer, who rose back to No. 4 in today’s rankings, has now won multiple titles in 15 of the past 16 seasons.
"What a week it's been for me," Federer told ATPTour.com. "I'm just so happy right now. It's unbelievable. I played here in 1999 for the first time, and here I am in 2019. It means a lot to me."
For Barty, who won the US Open women’s doubles title with Coco Vandeweghe last September, the Miami title propels her into the Top 10 for the first time in her career.
The Australian 22-year-old has won singles titles in each of the past three seasons, with victories in Nottingham and Zhuhai last year and in Kuala Lumpur in 2017.
Seeded 12th in Miami, Barty faced a tough draw in the Florida sunshine, but she dropped just eight total games in toppling Dayana Yastremska of Ukraine and fellow Australian Sam Stosur, and she fought from a set down to defeat No. 7 seed Kiki Bertens of the Netherlands in the Round of 16.
Barty needed three sets to upset world No. 2 Petra Kvitova of the Czech Republic in the quarterfinals before booking her place in the final with a 6-3, 6-3 win over world No. 19 Anett Kontaveit of Estonia.
"It's been an amazing fortnight of tennis. It really has," said Barty. "I think it's pretty cool to have played such a good match today, obviously in a big situation and a big match. Certainly proud of myself and happy the way that my team and I have been able to get through these two weeks."