MADRID -- Novak Djokovic played singles and doubles matches but couldn't prevent Serbia from losing to Russia 2-1 in the Davis Cup quarterfinals on Friday.

Djokovic defeated Karen Khachanov 6-3, 6-3 in the second singles to even the score at 1-1, then returned to the court about half an hour later to team up with Viktor Troicki in the decisive doubles. They had three match points but lost to Khachanov and Andrey Rublev 4-6, 6-4, 7-6 (8).

"It hurts really badly," Djokovic said. "These kinds of matches happen once in maybe forever. That's it. The season is done and we're turning the next page."

The Russians converted on their first match point to put the team back in the Davis Cup semifinals for the first time since 2008.

"Both teams had a lot of chances," said Rublev, who won the opening singles against Filip Krajinovic 6-1, 6-2. "It was like a coin toss, and we won this coin toss."

Russia will next face Canada, which eliminated Australia. The Russians are seeking their third Davis Cup title, and first since 2006.

Serbia, the 2010 Davis Cup champion, was trying to return to the semifinals for the first time since 2017, when the team lost to eventual champion France.

After his 15th straight Davis Cup singles victory, Djokovic struggled in the doubles, although it was Troicki who squandered most of the chances in the tight tiebreaker, including some during the match points.

"I probably feel the worst ever," Troicki said. "I never experienced such a moment in my career, in my life. And I let my team down, and I apologize to them."

Djokovic, who hadn't played in the Davis Cup since 2017, couldn't hide his frustration as Serbia trailed in the second set, complaining with the umpire and hitting a ball deep into the stands after losing a point. He also requested medical assistance on his right arm.

Serbia was trying to reach the last four for the fourth time since winning its only Davis Cup title in 2010. It was runner-up once since then, in 2013.

Serbia cruised through the group stage without losing a set in singles. Its only loss came in a dead doubles rubber against France.

Russia defeated defending champion Croatia in the group stage but then lost to host Spain, advancing to the quarterfinals as one of the two best second-place finishers. It was playing on two days' rest, while Serbia played on Wednesday and Thursday.