Updated

Reigning two-time champion Novak Djokovic and David Ferrer were a pair of quarterfinal winners Tuesday at the Australian Open.

The world No. 1 Djokovic recovered from his five-set marathon in the fourth round and claimed a 6-1, 4-6, 6-1, 6-4 victory over former Wimbledon runner-up Tomas Berdych after the fourth-seeded Ferrer had rallied from a two-set and a break deficit to stave off fellow Spaniard Nicolas Almagro, 4-6, 4-6, 7-5, 7-6 (7-4), 6-2 for his 500th career match win.

Djokovic will meet Ferrer in a marquee semifinal here on Thursday.

The 25-year-old Djokovic needed just over five hours to hold off Swiss slugger Stanislas Wawrinka on Sunday, but had to play about half that long to continue his domination of Berdych. The three-time Aussie Open champ improved to 12-1 lifetime against the fifth-seeded Czech star. Djokovic broke serve six times and had his serve broken only once on Day 9.

"It was a great performance," Djokovic said. "I was hoping to have a shorter match and not go over five hours like the last match.

"It is always going to be tough against Tomas ... but I came out and played my best tennis."

Djokovic is trying to become the first three-peat Aussie Open champ in the Open Era (since 1968).

Meanwhile, Ferrer was also facing an opponent he has completely owned and faced plenty of adversity on Tuesday, but still managed to stay perfect in 13 all-time meetings with Almagro.

The 10th-seeded Almagro was making his first quarterfinal appearance at the Aussie Open, but has been in the quarters at Roland Garros on three separate occasions, including last year.

Almagro converted on both of his break opportunities in the first two sets while also taking advantage of 24 unforced errors by Ferrer over that span to take a seemingly comfortable two-set advantage.

Ferrer failed to convert on two chances to break his opponent in the first two sets.

Each player held serve in the third set until Ferrer's return of an Almagro volley went long to allow his compatriot to take a 4-3 advantage.

Almagro then capped the ensuing game with a powerful ace down the line, and after staying alive by holding his serve, Ferrer took advantage of three of unforced errors by his opponent to return the favor and even the set at five games apiece.

After Ferrer held serve again, Almagro began to unravel a bit as he committed several mistakes to allow Ferrer to earn his second break of the set and stay alive.

With the score tied at four games apiece in the fourth set following a pair of breaks by each player, Almagro battled back from a 15-40 hole in the fifth to earn his third break of the set when a Ferrer return went long, giving Almagro a chance to again serve for the match.

But he failed to convert for the second time despite overcoming a love-30 hole to force a deuce.

The two again traded breaks before Almagro suffered a leg injury while Ferrer took the tiebreak, 7-4.

Almagro received some treatment before the start of the final set, but he was obviously hurting and Ferrer took advantage by controlling the action in the decisive set with five aces and nine winners.

"It was (a) miracle I won this match, I think," Ferrer said. "I tried to fight every point, that's my game. I always fight.

"In the important moments, I played more consistent in my game. Of course, in the next round, the semifinals, I need to play my best tennis, better than today."

The 30-year-old Ferrer, fresh off his title in Auckland two weeks ago, will face Djokovic for 15th time, with the powerful Serb leading their lifetime series 9-5, including 2-0 at the Aussie Open. Djokovic beat Ferrer in the quarterfinals here a year ago and back in 2008.

"Nole is a special player," Ferrer said.

The quarterfinals will conclude on Wednesday, when second-seeded former No. 1 Roger Federer meets seventh-seeded former Aussie runner-up Jo-Wilfried Tsonga and third-seeded Andy Murray takes on unseeded Frenchman Jeremy Chardy. Federer owns a men's-record 17 Grand Slam titles, including last year's Wimbledon championship and four Aussie Open crowns. Murray was last year's U.S. Open and Olympic champion and was the back-to-back Aussie runner-up in 2010 and 2011.