MADRID -- Rafael Nadal kept Spain's hopes alive, then Marcel Granollers and Feliciano López completed the comeback in the decisive doubles match to give the hosts a 2-1 win over Russia in the inaugural Davis Cup Finals.
Granollers and López defeated Karen Khachanov and Andrey Rublev 6-4, 7-6 (5) to seal the victory for Spain in a marathon series that ended close to 2 a.m. local time (0100 GMT) on Wednesday.
The top-ranked Nadal earlier defeated Khachanov 6-3, 7-6 (7) to level the series 1-1 after Rublev had rallied to beat Roberto Bautista-Agut 3-6, 6-3, 7-6 (0) in the first match.
"It was a difficult situation for us," López said. "We needed this win, otherwise we could be close to being out of the tournament. Now we are in a good position to advance."
Although only one of the matches reached three sets, it took nearly eight hours to complete the series at the "Caja Mágica" (Magic Box) center court. Spain will be back in action on Wednesday against defending champion Croatia. Russia beat Croatia on Monday.
In the revamped Davis Cup format debuting this year, teams play only two singles and a doubles in each tie, with the group winners advancing to the knockout stage along with the two best second-place finishers in the six groups.
"The format makes things very difficult because every mistake puts you in a position that you don't want to be," Nadal said. "And losing that first match, we were under pressure."
Serbia's Novak Djokovic and Britain's Andy Murray will make their first appearance on Wednesday. Serbia takes on Japan and Britain plays the Netherlands.
The Davis Cup Finals is being played in World Cup-style with all 18 teams playing in a single venue in the same week. It is the result of a 25-year partnership between the International Tennis Federation and Kosmos, a group co-founded by Barcelona soccer player Gerard Piqué.
Brazil star Neymar was among the more than 12,000 in attendance, which also included a marching band organized by Spanish fans that fired up the crowd throughout the matches.
FRANCE WINS
Two days after clinching the doubles title in the ATP Finals, French duo Pierre-Hugues Herbert and Nicolas Mahut secured France an opening win.
Herbert and Mahut rallied to defeat Ben McLachlan and Yasutaka Uchiyama of Japan 6-7 (4), 6-4, 7-5 in the deciding doubles match in Group A, giving top-ranked France a 2-1 victory.
The French duo squandered two match points while serving at 5-4, but capitalized on their chance at 6-5 to clinch the victory for last year's Davis Cup runner-up.
The teams were tied after Jo-Wilfried Tsonga cruised past Uchiyama 6-2, 6-1 and Yoshihito Nishioka defeated Gael Monfils 7-5, 6-2.
Herbert and Mahut did not drop a single set in five matches at the ATP Finals, where they defeated Raven Klaasen of South Africa and Michael Venus of New Zealand in the final on Sunday.
"We know we've arrived late from London, but the captain had a lot of confidence in our team," Mahut said. "There was a lot of intensity in the win but we're really happy today. This was a really difficult tie."
ARGENTINA CRUISES
Argentina comfortably got past Chile 3-0 in Group C, with Guido Pella beating Nicolas Jarry 6-4, 6-3 and Diego Schwartzman defeating Cristian Garin 6-2, 6-2.
The tie was already decided when Máximo Gonzlez and Leonardo Mayer topped Jarry and Hans Podlipnik-Castillo 6-3, 7-5 in the doubles match.
"It's the end of the season but I think I played one of the best matches for sure of the year, maybe in my career," the 14th-ranked Schwartzman said. "I think Guido helped me a lot to be more confident in this match and I played unreal tennis."
KAZAKHSTAN WINS AGAIN
Kazakhstan also needed the doubles match to beat the Netherlands 2-1 and clinch its first away Davis Cup win since 2011.
The Group E victory came after Mikhail Kukushkin and Alexander Bublik defeated Robin Haase and Jean-Julien Rojer 6-4, 7-6 (2). Kukushkin had beaten Botic van de Zanschulp 6-2, 6-2, while Haase defeated Bublik 7-5, 3-6, 7-6 (5).
"I almost died there," Bublik said, jokingly.
AUSTRALIA AHEAD
Australia beat Colombia behind Nick Kyrgios' 6-4, 6-4 win over Alejandro González and Alex de Minaur's 6-4, 6-3 victory over Daniel Elahi Galan.
Colombia had lost to Belgium on Monday.