ST. PETERSBURG, Russia — Milos Raonic was surprisingly ousted by local hope Mikhail Youzhny 2-6, 7-6 (6), 6-4 in the second round of the St. Petersburg Open on Thursday.

Youzhny toughed out a 10-minute final game to cap the match in 2 1/2 hours and his first win over a top-10 player in more than two years.

Raonic, the world No. 6 who came to St. Petersburg as the reigning champion and had a first-round bye, has lost three of his last four matches on tour.

Youzhny improved his record in St. Petersburg to a tournament-best 33-12, including the 2004 title and two other finals. He said he felt he was playing his best tennis in three years, when he last won a title, and was fired up by the Russian crowd.

“It’s only possible in St. Petersburg,” he said.

In his third quarterfinal of the year, he will play fifth-seeded Alexander Zverev of Germany, who beat Russian qualifier Daniil Medvedev 6-3, 7-5.

Third-seeded Tomas Berdych dug deep to reach the quarterfinals as he defeated leading Russian Andrey Kuznetsov 6-3, 2-6, 7-6 (4) and next plays Italian Paolo Lorenzi, who saw off French qualifier Alexandre Sidorenko 7-6 (6), 6-4.

Earlier, seventh-seeded Viktor Troicki beat fellow Serb Dusan Lajovic 6-4, 6-4 to set up a quarterfinal with U.S. Open champion Stan Wawrinka.

Eighth-seeded Joao Sousa, the 2015 runner-up, also made the last eight, beating Russian wild card Andrey Rublev in three sets.