Updated

Fourth-seeded David Ferrer rallied back from a two-set deficit to take a 4-6, 4-6, 7-5, 7-6 (7-4), 6-2 victory over fellow Spaniard Nicolas Almagro and advance to semifinals of the Australian Open for the second time in three years.

The 10th-seeded Almagro, who has lost all 13 career meetings with Ferrer, was making his first quarterfinals 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 40-15 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 30-0 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.

Tuesday's other quarterfinal matchup will pit world No. 1 Novak Djokovic against fifth-seeded Tomas Berdych.

Djokovic has won three of the last five Aussie Open titles, including the last two. The five-time Grand Slam champion beat Rafael Nadal in last year's Melbourne finale, which was the longest-ever final in Grand Slam history, and is trying top become the first men's three-peat Aussie champ in the Open Era.