Updated

The long rally went corner to corner for more than two dozen strokes, lasting so long that even the inexhaustible Rafael Nadal needed a minute to catch his breath.

He stood behind the baseline, panting as he slowly toweled off before summoning one final burst of energy. One point later, Nadal had the victory and a berth in the quarterfinals at the Sony Ericsson Open.

Nadal swept five consecutive games midway through the match Tuesday and beat No. 16-seeded Kei Nishikori 6-4, 6-4.

The victory was by far Nadal's most taxing of the tournament, and he took a medical timeout late in the opening set for treatment of his troublesome left knee. Even so, he's one round closer to his first Key Biscayne title.

"I am not probably in perfect condition today with the left knee," he said. "But the important thing is to try to win as many matches as possible. For me this is an important tournament, and every victory has very, very big value for me, especially without being perfect."

Nadal, a three-time runner-up at Key Biscayne, lost the final last year to Novak Djokovic, and they could meet again Sunday. The top-ranked Djokovic reached the final eight by beating No. 17-seeded Richard Gasquet 7-5, 6-3.

No. 8 Mardy Fish edged No. 12 Nicolas Almagro 6-3, 6-7 (2), 6-3. Fish was relegated to the grandstand court for the third consecutive match rather than the stadium, even though he's the top-ranked American man, but the slight didn't faze him.

"I certainly want to play on stadium court," Fish said. "But they've got to put someone out on the grandstand, and who's that going to be? Are you going to put Federer out there, or Djokovic, or Nadal, or Serena? I'm not going to go ahead of those guys as far as people coming to watch them play. You've got to go where you've got to go."

No. 2 Maria Sharapova — playing in the stadium — became the first semifinalist when she drubbed reigning French Open champion Li Na 6-3, 6-0. Sharapova had lost their previous four meetings.

"I just really wanted to change that," she said, "so I was extremely focused and, you know, looking forward to the match."

Like Nadal, Sharapova seeks her first Key Biscayne title. She lost the final in 2005, 2006 and last year.

Nadal has been bothered by his knee since Indian Wells, where he lost to Roger Federer in the semifinals two weeks ago. Nine games into his match against Nishikori, Nadal called a medical timeout and had a trainer tape his leg.

That's when the momentum swung. In the next game, Nadal took the opening set with a service break when Nishikori sailed an easy forehand long. The Spaniard broke again as he raced to a 3-love lead in the second set.

"At the end of the first set, I felt that I started to win my serves easier than him," Nadal said. "I had more the control of the game."

Nadal improved to 16-3 this year. He's seeking his first tournament title since the 2011 French Open.