By Mitch Phillips

LONDON (Reuters) - Defending champion and top seed Rafa Nadal showed all his fighting spirit and irrepressible will to win when he overcame a painful foot injury and a testing examination from Juan Martin Del Potro to advance to the Wimbledon quarter-finals on Monday.

The Spaniard looked in danger of having to withdraw after receiving lengthy treatment at the end of the first set but gritted his teeth to take the subsequent tiebreak en route to a battling 7-6 3-6 7-6 6-4 victory.

"I thought I'd have to retire," Nadal said of the problem that needed 10 minutes of on-court attention.

"I felt something very strange. I don't know what the problem is yet, it seems like it's in the bone, in the foot.

"The tape changed probably the position of the foot and the distribution of the power so I was able to continue with a bit of pain."

The injury was just a talking point from one of the best matches of the tournament as Del Potro proved a dangerous floater as he continues his recovery and climb back up the rankings following wrist surgery.

There was nothing between the two players in a first set littered with crunching forehands but things looked worrying for Nadal before the tiebreak when he needed lengthy treatment for the injury.

"It's near the bone, it's really painful," he told the physio on court.

Del Potro hit back with two mini-breaks but Nadal showed all his fighting qualities to come back again and took the tiebreak 8-6 when Del Potro double-faulted.

The Argentine, aiming for his first grand slam quarter-final since his 2009 U.S. Open victory, continued to look the more consistent server but even he was reduced to clapping his opponent after one miraculous Nadal recovery shot when the Spaniard faced break point.

Del Potro did break in the eighth game, though, and took the set after getting the better of an exchange of drop shots that had the Center Court crowd drooling.

In the third set it was Del Potro's turn to need treatment after he hurt his left thigh when he slipped on the base line but he too recovered fully to take the set to another tiebreak, only for Nadal to take it.

It was captivating stuff, both players unloading hugely powerful groundstrokes and finding seemingly impossible angles, but the match turned decisively Nadal's way when he broke for the first time in the fifth game of the fourth set.

The Spaniard then showed steely nerve to hold serve in the next game after trailing 0-30 and eventually completed victory in almost four memorable hours.

In the last eight, he faces American Mardy Fish who he has beaten in all five previous meetings.

(Editing by Ed Osmond)