Novak Djokovic came through a gruelling four-hour match against Spanish 13th seed Roberto Bautista Agut to reach the last 16 at the French Open.
The 12-time Grand Slam champion was given his toughest test this year but won 6-4 6-7 (6-8) 7-6 (7-4) 6-2 after three hours and 48 minutes.
The Serb, 31, is seeded 20th as he searches for his best form following his return from an elbow injury.
He will play Spain's 30th seed Fernando Verdasco in the fourth round.
Verdasco, 34, earned a shock 7-6 (7-4) 6-2 6-4 win over Grigor Dimitrov - the Bulgarian fourth seed and reigning ATP World Tour Finals champion.
After a quarter-final defeat by Dominic Thiem last year, Djokovic returned to Roland Garros not expected to challenge for the title following a year disrupted by an injury which needed surgery after the Australian Open in January.
A lack of action since has resulted in him dropping to 22nd in the world rankings - below Bautista Agut.
But his greater pedigree eventually shone through in a physical encounter on Court Suzanne Lenglen.
The former world number one has now made the last 16 of a Grand Slam for the 43rd time, tying with Jimmy Connors on the all-time list.
Djokovic's history with the French Open has been a varied one, having suffered three final defeats in 2012, 2014 and 2015 before eventually landing the prize in 2016 - finally sealing his career Grand Slam with victory over Andy Murray.
And he again experienced a range of emotions - delight, disappointment, anger - at Roland Garros in an epic match which ended with two weary players smiling as they hugged at the net.
Djokovic controlled the opening exchanges without earning a break point and, after a slight wobble midway through a tight set where the pair traded baseline blows, converted his first opportunity to clinch the set.
Momentum continued to flow with Djokovic at the start of the second, breaking at the first chance, only to allow Bautista Agut back into the set when the Spaniard claimed his first break point of the match for 4-3.
Bautista Agut saved a set point on his serve at 5-4 down, fighting off two more at 6-5 to force the tie-break, then taking his third set point in the decider to level.
That came immediately after a furious Djokovic lost his temper when he missed a simple forehand, breaking his racquet by hammering it three times into the ground, drawing whistles from the crowd as he went to grab a new one.
Djokovic still had a moody expression when he returned to court for the third set - but that release of anger eventually seemed to work in his favour.
There were six breaks of serve in an erratic set before Djokovic clinched the tie-break shortly after the match clock passed the three-hour mark.
That gave him the impetus in the fourth set, going two breaks up before taking his second match point with a thumping overhead that Bautista Agut could not reach.
Bautista Agut has claimed two ATP Tour titles this year, winning in Auckland and Dubai
Bautista Agut is one of the most consistent players on the tour having climbed into the world's top 20 for the first time in July 2014 and not dropping out of the top 30 since.
However, he has never been able to break into the top 10 and has struggled to beat higher-ranked opponents on a regular basis.
It was anticipated the Spaniard would provide a sterner challenge to Djokovic than any of the Serb's previous opponents and his fighting spirit - not to mention his all-round game - troubled his decorated rival.
But it was remarkable Bautista Agut was even playing at Roland Garros following the death of his mother Esther on 21 May, days before the tournament began.
The 30-year-old said he wanted to play to take his mind off his loss.
The world number 13 put the difficult circumstances to one side as he focused on beating Djokovic for only the second time in their eight meetings.
However, he eventually ran out of energy - physically and mentally - as he was unable to reach the last 16 for the third straight year.