MELBOURNE, Australia — Novak Djokovic's bid for a fourth consecutive Australian Open title ended in a dramatic five-set quarterfinal loss to Stanislas Wawrinka, potentially leaving the door ajar for a new major champion.

No. 8-seeded Wawrinka lost 14 head-to-heads to Djokovic until a 2-6, 6-4, 6-2, 3-6, 9-7 win on Tuesday night put him into a semifinal against No. 7 Tomas Berdych. That means there'll be at least one finalist in Australia who has never won a Grand Slam title.

Djokovic held off Wawrinka 12-10 in the fifth set in a 5-hour, 2-minute fourth-rounder last year — the longest Grand Slam match of the season — en route to his third straight Australian title. He also edged Wawrinka in five sets in the U.S. Open semifinals.

This time, it was Wawrinka's turn.

"I don't want to lose every time in five sets against Novak. I had to find solution," Wawrinka said. "I had to fight within myself to fight against him and try to keep my line during the game. That's mean being really aggressive.

"Last year I took a lot of confidence with those match with Novak ... I came on the court with a lot of confidence in myself, knowing that if I play my best game, I always have a chance against him. "

This one took exactly four hours and featured some stunning rallies, with both players openly showing amazement at some of the shots coming back from the other side of the net. And just to add to the drama, there was a five-minute rain delay with Wawrinka serving at 5-5 in the fifth.

Djokovic had to constantly serve to stay in the match after an early exchange of breaks in the fifth set, and the pressure finally told.

After all the superb shot making, it was a mis-hit from Wawrinka that set up match point. Djokovic chased the floating service return to the net but skewed his cross-court drop shot wide. He then missed a volley on match point, ending a run of 28 consecutive wins dating back to his U.S. Open final defeat to Rafael Nadal.

"He took his opportunities. He deserved his big win today," Djokovic said. "It was a tough battle mentally, physically, emotionally obviously. This is what happens when you play a top player on this stage, when you go the distance in the fifth.

"He showed his mental strength and he deserved to win — the only thing I can say is congratulations."

Djokovic hadn't lost at Melbourne Park since 2010, when he went down to Jo-Wilfried Tsonga in the quarterfinals, and has been unquestionably the best player on Rod Laver Arena since 2011.

With his winning streak and his new coach, Boris Becker, he was installed as the tournament favorite immediately after the draw, when he landed on the opposite side to top-ranked Nadal, Wimbledon champion Andy Murray and 17-time major winner Roger Federer. Nadal plays 22-year-old Bulgarian Grigor Dimitrov in the quarterfinals on Wednesday, when Murray and Federer go head-to-head. That leaves all the major winners on one side of the draw.

Berdych, the 2010 Wimbledon finalist, reached his first Australian Open semifinal — completing a full set at that level in the majors — when he beat David Ferrer 6-1, 6-4, 2-6, 6-4. No. 3-seeded Ferrer was clearly frustrated at times, yelling at himself after points and bumping into a line judge after breaking Berdych in the sixth game of the third set.

The 31-year-old Spaniard said it was an accident in a "nervous moment," as he went for his towel, saying "It was nothing ... I say to him excuse me after that."

He could face a sanction for coming into contact with a match official.

On the women's side, 19-year-old Canadian Eugenie Bouchard reached the semifinals in her first trip to the Australian Open, beating Ana Ivanovic 7-5, 5-7, 6-2 to set up a showdown with two-time finalist Li Na.

"It's something I've been doing since I was five years old and working my whole life for and sacrificing a lot of things for, so it's not exactly a surprise," Bouchard said of her win over Ivanovic, who upset top-ranked Serena Williams in the fourth round. "I always expect myself to do well. "

Bouchard's run as the first Canadian into the Australian Open semifinalists means two-time finalist Li, who beat Flavia Pennetta 6-2, 6-2, will have to face a teenager for the third time in the tournament.