The 33-year-old Kvitova, 10 years older than her opponent, snapped seventh seed Rybakina's 13-match win streak and ended her bid to complete the Sunshine Double (Indian Wells and Miami Open) at the final hurdle.
In winning with will, stalwart defense and one sensational forehand winner on the dead run that electrified the crowd in the second set, lefthander Kvitova captured the 30th WTA singles title of her distinguished career and ensured a return to the world top 10.
After Rybakina hit a forehand long on match point, Kvitova raised her arms and put her hands to her head. She was broken just once in the match. It was her 41st career WTA Finals appearance but first final in Miami.
Kvitova, who is from the Czech Republican, disagreed with the announcement Wimbledon would accept Russian players this year. Rybakina, the reigning Wimbledon champion, is from Moscow but represents Kazakhstan.
A past Wimbledon champion, Kvitova won the first-set epic tiebreaker 16-14 on her fifth set point. A suddenly shaky Rybakina hit a forehand long to end the 22-minute tiebreaker; she had been undefeated at 7-0 in tiebreakers in 2023.
The set lasted 66 minutes during which each player held serve until 4-4 then exchanged service breaks.
Rybakina finished with 10 aces for the first set while setting the record for most aces in a WTA Tournament, smashing Madison Keys' mark. Rybakina, who had 12 aces total for the match, finished the tournament with 69 for the tournament.
Kvitova broke Rybakina in second game of the second set with a backhand winner on the service return to go up 2-0.