KEY BISCAYNE, Fla. -- An ankle injury forced two-time champion Victoria Azarenka to withdraw from the Sony Open on Friday, and Lauren Davis quickly went from lucky loser to lucky winner.

Given a spot in the draw when Azarenka pulled out, Davis took advantage of shaky play by Madison Keys in the decisive tiebreaker to win their second-round match 6-1, 5-7, 7-6 (7).

Davis trailed 6-3 in the tiebreaker and then saved three consecutive match points, all on unforced errors by Keys.

This was Davis' first victory at Key Biscayne, and the 19-year-old barely made the tournament. She learned at 10 a.m. that Azarenka had quit, and an hour later was playing on the stadium court.

"I didn't care if I won or lost," she said. "I just was so grateful for the opportunity to play."

No. 2-ranked Maria Sharapova was slowed only by a half-hour power outage during the night session, and she beat wild card Eugenie Bouchard 6-2, 6-0. Sharapova is a four-time runner-up at Key Biscayne, including in 2011 and 2012.

In men's play, two-time defending champion Novak Djokovic beat qualifier Lukas Rosol 6-1, 6-0 in 52 minutes. The match was the first for the No. 1-ranked Djokovic since his 22-match winning streak came to an end against Juan Martin del Potro last week in the Indian Wells semifinals.

Del Potro, seeded No. 5, lost a rain-interrupted match against Tobias Kamke of Germany, 7-6 (5), 6-1. The 26-year-old Kamke advanced to the third round of a Masters 1000 event for the first time.

"I was excited to play here," del Potro said, "but it was just a bad day, and he play really well."

No. 3 David Ferrer advanced by walkover when qualifier Dmitry Tursunov withdrew with acute gastroenteritis. Wild card James Blake, playing at Key Biscayne for the 12th time, had the stadium-court crowd cheering as he beat No. 24 Julien Benneteau 6-2, 6-3.

"You never know how many more chances I'll get like that playing in stadiums," Blake said. "I'm realistic. I hope I've got plenty left in the tank, but I'm also 33 years old. That's getting into senior-citizen range on tour."

Azarenka withdrew before her quarterfinal last week at Indian Wells because of inflammation and tendinitis in her right ankle. She returned to the practice court Wednesday, and the next day her injury was worse, she said.

She decided to withdraw after trying to practice Friday. Now she figures she needs another couple of weeks to recover.

"I really wanted to play here," she said. "That is very frustrating part. But I will take the necessary time for me to get rid of this problem and move on to the next chapter."

Ranked No. 3, Azarenka is 17-0 this year with two titles.

Once the No. 81-ranked Davis was granted a spot in the draw, she worked hard to keep it. In a matchup between two teenagers from nearby Boca Raton, she and Keys played for more than 2½ hours before reaching the tiebreaker.

Keys, an 18-year-old wild card, entered the tournament with a career-best ranking of No. 76. But when she served for the match at 6-3 in the tiebreaker, her inexperience showed.

She dumped groundstrokes into the net on consecutive points, then pushed a forehand wide for 6-all, and at 7-all she double-faulted. When Keys sailed a forehand long on the final point, she broke her racket by slamming it to the concrete.

"This will sting for a couple of days," she said. "The whole match bugs me. Early on I was going for too much. Then in the tiebreaker I was remember what happened earlier, and that made me more nervous."

Steadier from the baseline but a head shorter than Keys, the 5-foot-2 Davis won despite trailing 10-0 in aces and 43-10 in winners.

"I just relied on my fighting instincts to pull me through," she said.

Davis said she and Keys have known each other for several years. They practice together often and are good friends.

"We're always so competitive, and the score is always really, really close," Davis said. "It's the smallest things that make a difference."