Madrid: Rafael Nadal fired hosts Spain into the Davis Cup final as he joined Feliciano Lopez to win a thrilling late-night doubles and seal a nail-biting 2-1 victory over Britain on Saturday.

The world No. 1, playing like a man possessed, sent a capacity crowd in the Magic Box wild as he almost single-handedly hauled his country home and set up a final with Canada in the inaugural edition of the revamped competition on Sunday.

With the semi-final on a knife edge at 1-1 after the singles were shared, Nadal and veteran Lopez came through an electrifying doubles clash against Jamie Murray and Neal Skupski, winning 7-6(3) 7-6(8) to take five-time winners Spain into their first Davis Cup final since 2012.

Just as on the previous night against Argentina in the quarter-finals, Nadal first had to win his singles to drag his team level after Lopez was outplayed 6-3, 7-6 by Kyle Edmund.

Nadal completed that task with a 6-4, 6-0 win over Dan Evans, which extended his incredible run of Davis Cup singles wins to 28 since 2004, and, just like 24 hours earlier, he bounded back on court around half an hour later for a doubles decider.

In a match of gut-wrenching tension played in front of a frenzied football-style crowd in the 12,500-seater stadium, Nadal, 33, and Lopez, 38, squeezed out the first set on a tiebreak in which every single point felt like a drama.

With the clock ticking well past midnight yet again, the inspired British pair kept their noses in front on serve in the second set and when Lopez made a horrible mess of a smash on the Nadal serve at 5-6 they had a set point.

Nadal saved that one with a nerveless forehand winner down the line but there was more trouble for Spain in the tiebreak.

After an angry Nadal clashed with the umpire, Britain led 6-4 but Lopez saved the first set point with a big serve and then Nadal produced miracles to flick a lob over Murray before putting away a smash as the Scot replied with a lob.

It felt like Nadal was tackling Britain on his own as he saved a fourth set point with a monstrous forehand that whistled past Murray. Three-time Grand Slam champion Andy Murray, sitting at courtside after being left out, could not look.

Spain then had a match point which Nadal miscued, but when Skupski bunted a volley long it meant Lopez had a service point to seal it, and he delivered.