PARIS -- Novak Djokovic was not sure whether he would be able to play in the French Open quarterfinals after injuring his right knee Monday and needing anti-inflammatory pills to be able to finish his thrilling five-set victory against No. 23 Francisco Cerundolo.
Djokovic, down a set and a break in the match, rallied to win 6-1, 5-7, 3-6, 7-5, 6-3 at Roland Garros for his record 370th win in a Grand Slam match.
"I was," Djokovic said, "maybe three or four points away from losing this match."
Djokovic said he has been bothered by the knee for a couple of weeks, but it got worse after he tweaked it early in the second set Monday. He took a medical timeout, then was visited a few other times by a trainer and a doctor, who gave him the medicine that Djokovic said eventually helped him feel better and move without restrictions.
After the match, Djokovic said there was a moment where he wondered whether he should continue. He said early scans on the knee are positive, but he still has concerns and will have more scans Tuesday.
He is supposed to meet No. 7 seed Casper Ruud in the quarterfinals on Wednesday. Ruud, who eliminated No. 12 Taylor Fritz in four sets Monday, lost to Djokovic in the French Open final last year and to Rafael Nadal in the 2022 title match.
"I don't know until [Tuesday] if I can step out and play," Djokovic said of the quarterfinals. "I hope so. ... Let's see what happens."
This was the second consecutive five-set comeback victory that lasted about 4½ hours for Djokovic, who is ranked No. 1. In the third round, he also fell behind in sets 2-1 but made his way past No. 30 Lorenzo Musetti, 22, from Italy, finishing Sunday after 3 a.m. -- the latest finish in French Open history.
With Monday's victory, Djokovic broke a tie with Roger Federer for the most match wins at major tournaments -- and also for the most Slam quarterfinals for a man by reaching the 59th of his career.
The first signs of trouble for Djokovic came in the second set, when he began flexing his right leg. He took a medical timeout and laid down on a towel placed on the sideline, where a trainer massaged that knee then had Djokovic flip onto his belly to work on his hamstring.
Djokovic winced as his right leg was manipulated, a scene repeated at subsequent changeovers.
The No. 1-ranked Djokovic ultimately triumphed in ways that have become familiar through his years of dominance and 24 major trophies, both turning around a contest after trailing and emerging when the tension is greatest.
He is now 40-11 in fifth sets over his career.
"How did I find the way to win again? I don't know," Djokovic told the crowd at Court Philippe Chatrier. "The only explanation I have is you. Thank you."
Against Cerundolo, 25, from Argentina, who was trying to reach his first Grand Slam quarterfinal, Djokovic, 37, again used all of his skills, experience and ability to adjust on the fly. He came through, in part, by playing more aggressively and putting extra speed on his groundstrokes, while dealing with whatever was going on with his knee.
Djokovic trailed 4-2 in the fourth set but surged from there.
At 4-3 in the fourth, he smacked a winner to earn a break point -- evoking roars from the stands -- and converted when Cerundolo netted a shot.
Djokovic shook his racket overhead, and a chant of his two-syllable nickname rang out, "No-le! No-le!"
At 2-1 in the fifth set, Djokovic's feet gave way as he chased a ball to his right, and he rolled on the ground, caking his white shorts, his red shirt and parts of his arms and legs with the rust-colored clay. As he walked to the sideline to grab a bottle of water to help clean off, he gave a piece of his mind to anyone who would listen, renewing an earlier complaint about wanting the court to be swept to improve traction.
That request was rejected as the sweeping schedule is pre-agreed to.
"Well done, supervisor and everybody," Djokovic said, his voice drenched in sarcasm. "Not slippery at all."
Yet he was just fine at 3-all in that set, when he stretched and slid, doing the splits, while somehow getting his racket on the ball for a drop volley to win a point. His chest on the ground, Djokovic stuck out both arms, mimicking an airplane, and smiled.
After the match, Djokovic said he believed there was "little to no clay" on the court and that the knee injury happened because he slipped "too many times."
During play, Djokovic stumbled occasionally. And limped a bit. After some lengthier points, he leaned on his racket or bent at the waist and rested with his hands on his knees or crouched.
He said he received a "maximum dose" of meds from his trainer to deal with the knee discomfort and it helped him once it kicked in near the end of the fourth set.
"[That's] when things started to really improve for me," Djokovic said. "I started to feel less limitations in my movement. Basically the whole fifth set was almost without any pain, which is great, you know."
When he missed a backhand that allowed Cerundolo to convert a break point for the first time in 13 tries, Djokovic handed over the second set. Soon, Djokovic was staring at a hole of two sets to one. And not long after that, he was down 4-2 in the fourth.
Ruud, the two-time French Open runner-up, ousted Fritz 7-6 (6), 3-6, 6-4, 6-2. The other men's matchup scheduled for Wednesday will be No. 11 Alex de Minaur against No. 4 Alexander Zverev, who was a 4-6, 6-1, 5-7, 7-6 (2), 6-2 winner against No. 13 Holger Rune in a match that ended at 1:40 a.m. on Tuesday.
On Monday, de Minaur defeated No. 5 Daniil Medvedev 4-6, 6-2, 6-1, 6-3 to become the first Australian man in the French Open quarterfinals since Lleyton Hewitt in 2004.
ESPN's Tom Hamilton and The Associated Press contributed to this report.