This is why Stan Wawrinka went through two operations on his left knee in the span of a month. Why he dealt with the rigors of rehabilitating that joint.

Why he did all the work, on and off the court, required to get back on the grind, to raise his ranking from outside the top 250, to matter again in the sport he loves.

So he could participate in, and win, matches like the 5-hour, 9-minute test of excellence, endurance and emotions that the 34-year-old Wawrinka barely claimed against the 20-year-old, caked-in-clay Stefanos Tsitsipas by a 7-6 (6), 5-7, 6-4, 3-6, 8-6 score Sunday at the French Open to reach a Grand Slam quarterfinal for the first time in two years.

And so he could advance to what comes now: a matchup Tuesday against his friend and countryman Roger Federer, who hasn't dropped a set so far in the tournament.

"That's the reason why came back. ... I love and enjoy to play in front of people, to play in the biggest tournaments you can play. Today was something really special," said Wawrinka, who won the 2015 championship at Roland Garros for one of his three major trophies. "For sure, when I'm on the court, I try to enjoy and remember, also, everything I have done to be here."

Exhausted as he was by a match finally decided by a backhand that floated past Tsitsipas and landed on the outside edge of a line, Wawrinka still possessed the energy to joke about facing Federer, who has won 22 of their previous 25 meetings.

When a reporter, perhaps trying to offer some hope, pointed out that Federer, 37, is the older man, Wawrinka smiled and responded: "Yeah, but he is much better than me, also. So never forget that."

The No. 6-seeded Tsitsipas was not in any mood to laugh: He said this close-as-can-be loss — he accumulated more total points, 195-194 — caused him to shed post-match tears for the first time in a long time.

"Never experienced something like this in my life. I feel very disappointed," said Tsitsipas, who upset Federer at the Australian Open in January en route to his first Grand Slam semifinal. "Emotionally, wasn't easy to handle. I will try to learn from it as much as I can."

Asked moments later what lessons he might have gleaned, Tsitsipas looked blankly ahead and answered in a monotone: "I have no idea. My mind is so empty right now. I cannot even think, so I don't know."

As the sun blazed, unobstructed by clouds, and the temperature soared toward 85 degrees Fahrenheit (30 Celsius), Wawrinka and the diving-for-volleys Tsitsipas provided by far the best theater around the grounds.

Spectators at Court Suzanne Lenglen cheered wildly for Wawrinka when he egged them on, cupping his ear or flapping his arms or even blowing a kiss. Tsitsipas' electric, net-rushing style earned support, too, although he chastised himself early on for playing "like a freaking zombie!"

The key, ultimately, was this: Wawrinka saved 22 of 27 break points, including 8 of 8 in the fifth set.

"I was so close. So close. I gave him room to do whatever he likes, all those break points," Tsitsipas said, pausing frequently between words. "So many break points. So many."

Nothing quite so riveting earlier, when Federer beat 68th-ranked Leonardo Mayer of Argentina 6-2, 6-3, 6-3 to become the oldest men's singles quarterfinalist in Paris since 1971.

Federer is back at Roland Garros for the first time since 2015, when he lost to Wawrinka in the quarterfinals. They've known each other forever, basically, and paired up to win a doubles gold medal for Switzerland at the 2008 Beijing Olympics.

"I'm just happy for the guy that he's back after his knee problems. They were severe, and that's why I think he's really happy he got sort of a second life on tour. Because I think for a while there, he wasn't sure if he was ever going to come back again. It's nice to see him pain-free and playing well," said Federer, who didn't face so much as a single break point Sunday. "I hope he's not at the level of '15, but we'll find out, because there, he was crushing the ball. It was unbelievable."

Joining Federer in the quarterfinals, oddly enough by the same score, was 11-time champion Rafael Nadal, who was never troubled by 78th-ranked Juan Ignacio Londero of Argentina. Nadal next meets No. 7 Kei Nishikori or Benoit Paire, whose match was suspended because of darkness with Nishikori leading two sets to one.

The two women's quarterfinals established Sunday: 2017 U.S. Open champion and 2018 French Open runner-up Sloane Stephens vs. No. 26 seed Johanna Konta, and No. 31 Petra Martic vs. 19-year-old Marketa Vondrousova .

Wawrinka had elbowed his way into the upper echelon of the sport — no easy feat in this era of Federer, Nadal and Novak Djokovic — with his trio of majors and a career-best ranking of No. 3, when he needed knee surgery in August 2017, a few months after losing in the French Open final.

He then needed another procedure, and the path back has been arduous, including a first-round loss a year ago in Paris, shortly before his ranking slumped to 263rd. But he has climbed enough to be seeded No. 24.

"It's never sacrifice when you love what you're doing. For sure, last two years were tough, but again, I have been here before," Wawrinka said. "I think I know exactly what I'm doing."