MIAMI GARDENS, Fla. -- Roger Federer knew he had things going his way at the Miami Open when he hit three shots off his frame during a wild, 17-stroke exchange and still won the point because Filip Krajinovic dumped a half-volley into the net.

Krajinovic quickly grabbed the ball and flipped it over the net as if continuing the rally, which drew cheers from the crowd and a smile from Federer.

"We're not robots," Federer said. "I like when players show emotion like Filip did in that instant. It was a weird, strange, ridiculous point that I got very lucky to win somehow."

A little lucky and really good, Federer won 7-5, 6-3 Monday to reach the fourth round. He improved to 14-2 this year, signaling he's a threat to win his fourth Miami title.

He'll next play No. 13 Daniil Medvedev, who won a battle of dominating serves against 6-foot-11 qualifier Reilly Opelka 7-6 (5), 6-7 (5), 7-6 (0). There were no service breaks but plenty of aces -- 19 by Medvedev and 22 by Opelka.