Mirra Andreeva appeared to have everything under control in the first set of her second-round match in Miami against McCartney Kessler.

She needed just 21 minutes to grab the opener 6-1 in commanding fashion. But things tightened from there. The 18-year-old was pushed to three sets by the American, yet after an emotional exit in Indian Wells, Andreeva was intent on delivering a different outcome. She did just that, closing out a 6-1, 6-7 (3), 6-1 victory in the early hours of Friday morning.

Miami: Scores | Draws | Order of play

“I’m kind of learning from my mistakes, I guess,” Andreeva said in her on-court interview. “So I’m just super happy to win this match, super happy to get the win tonight…this morning. She’s an amazing player, a very dangerous opponent, so I’m just super happy to get revenge against her and to advance further in the tournament.”

The revenge she referenced was for a straight-sets loss to Kessler last year in Montreal, their first meeting at the WTA Tour Driven by Mercedes-Benz level. Their head-to-head is now even at one win apiece.

And while capturing revenge and maintaining her composure were reason enough for Andreeva to be “super happy,” her overall level was another. An efficient brand of tennis powered her late-night (or early-morning) success.

She finished with 24 winners to 21 unforced errors, blending timely aggression with a commitment to keeping the ball in play against an opponent eager to take her own chances. Kessler finished with 25 winners but 36 unforced errors.

Forehand, backhand — even the occasional drop shot — everything was working for Andreeva as she earned her first victory on Stadium in Miami.

Her crowning highlight came while serving with a 4-1 lead in the opening set. A net cord pulled her forward, and she showed off her doubles instincts, defending a pair of Kessler returns before finally putting away a winner en route to a hold for 5-1.

She broke Kessler at love in the next game to seal the set.

The second set, however, went Kessler’s way. The American returned the favor by breaking at love for a 2-1 lead, and while Andreeva broke back a few games later to level at 4-4, Kessler controlled the ensuing tiebreak. A forehand winner gave her a 4-2 edge — one she never relinquished — to force a decider.

But the final set, and ultimately the match, belonged to Andreeva. After the American held for 1-0, Andreeva won the final six games to survive the upset-minded Kessler in a match that happened to coincide with the first day of March Madness.

Next up for Andreeva is a date with No. 32 seed Marie Bouzkova in the third round. She leads the head-to-head 3-0, with all three wins coming in straight sets.