Three-time champion Novak Djokovic lost to Tommy Haas, 6-2, 6-4 Tuesday in the fourth round of the Sony Open.

The defeat ended Djokovic’s 14-match winning streak at Key Biscayne, where he won the tournament the past two years.

The top-ranked Djokovic has lost two of his past four matches after winning 22 in a row, including the Australian Open for his sixth Grand Slam title.

On the women’s side, five-time champion Serena Williams advanced to the semifinals and equaled the women’s record for career victories in the tournament by beating No. 5-seeded Li Na 6-3, 7-6 (5).

The oldest player in the top 50, Haas is making his 13th appearance at Key Biscayne and advanced the tournament’s quarterfinals for the first time. His opponent Wednesday will be Gilles Simon, who rallied past Janko Tipsarevic, 5-7, 6-2, 6-2.

“This is crazy,” Haas said. “Playing against someone like Novak and coming out on top at this time of my career, it’s unbelievable.”

The top-ranked Djokovic has lost two of his past four matches after winning 22 in a row, including the Australian Open for his sixth Grand Slam title.

Djokovic appeared out of sorts from the start of the match. During his second service game he became annoyed at fans shouting as he was about to serve.

The Serb hit consecutive forehand errors to lose serve and fall behind 3-2, the start of a stretch where Haas won six consecutive games. The German hit three spectacular winners to break again for a 5-2 lead, and Djokovic double-faulted to lose serve once more in the opening game of the second set.

Djokovic broke for the only time to reach 3-3, but lost his serve again. Haas closed out the victory with a forehand winner, then shared a warm exchange at the net with a gracious Djokovic, who gave the crowd a wave as he left the court.

The top-ranked Williams overcame six double-faults and rallied in the second set from a 5-2 deficit. She hit six winners in the tiebreaker, including a forehand passing shot cross-court on the final point.

Williams, who won her most recent Key Biscayne title in 2008, improved to 59-7 in the tournament. Steffi Graf, another five-time champion, went 59-6.

“I hope to get more,” Williams said.

No. 2 Andy Murray, the champion in 2009 and runner-up last year, returned to the quarterfinals by beating No. 16 Andreas Seppi 6-2, 6-4. No. 8 Richard Gasquet hit 17 aces, including three in the final tiebreaker, and advanced to his first Key Biscayne quarterfinal by beating No. 10 Nicolas Almagro 6-7 (3), 7-5, 7-6 (3).

No. 3 David Ferrer beat No. 13 Kei Nishikori 6-4, 6-2, while No. 11 Gilles Simon came back to beat No. 7 Janko Tipsarevic 5-7, 6-2, 6-2.

Ferrer’s next opponent will be unseeded Jurgen Melzer, who rallied past Albert Ramos 2-6, 6-3, 6-3.

Sam Querrey lost his fourth-round match, and for the first time the tournament will have no American in the men’s quarterfinals.

Querrey, playing his first tournament as the top-ranked American on the ATP Tour, lost to Tomas Berdych 6-1, 6-1 in 50 minutes.

On a breezy, sun-splashed afternoon, Williams and Li both struggled with their second serve.

“It was like, ‘Look, I just can’t hit any more double-faults,’” Williams said. “It’s embarrassing and unprofessional. I hit about 50 in one game, and it was just outrageous.”

Li had seven double-faults, with three giving Williams her only break points.

In the tiebreaker, Williams didn’t need a second serve. She hit consecutive service winners for a 4-3 lead, then two more to go up 6-5.

When Williams smacked a winner on match point she jumped for joy cannonball-style, knees high and fist raised.

“I don’t usually leap like that in the quarterfinal,” she said. “But it was just a good shot.”

Williams, who is assured of remaining No. 1 next week, will next play defending champion Agnieszka Radwanska, who hit a desperation shot behind her back for a winner en route to a victory over No. 30 Kirsten Flipkens, 4-6, 6-4, 6-2.

More In: Tennis | Sport