The German, however, proved too strong ultimately, breaking five times for a 6-4 7-5 win on the main stadium hardcourt at Crandon Park.
"It's always good to have close sets, especially when you win them at the end. They give you confidence that you can go out in your next match knowing you can win close matches because you've just done it a day ago,” Kerber told reporters.
“You win the match, you're always happy about your performance.
"In the second set, she was 4-2 up and we'd played a long game. That was important because she was playing well, but I was staying positive and believing in my chances. I think that was the key to the match."
Keys fell to 72nd-ranked Spaniard Lara Arruabarrena 7-5 7-5. She was playing her second tournament since returning from wrist surgery.
Russian seventh seed Kuznetsova, the runner-up last year, stayed on track for another tilt at the championship when she bested American qualifier Taylor Townsend 6-4 6-2.
A week after losing the Indian Wells final to compatriot Elena Vesnina, Kuznetsova’s stronger second serve proved the difference, as she was broken just once while breaking her opponent four times.
The next challenge for 2006 champion Kuznetsova will be 11th seed Venus Williams, a three-time Miami champion, who was far too good for Romanian qualifier Patricia Maria Tig 6-3 6-0.
British 10th seed Johanna Konta and Australian 14th seed Sam Stosur also won their third round matches.
(Reporting by Andrew Both in Cary, North Carolina, editing by Gene Cherry)