World number one Rafael Nadal overcame an error-strewn performance and Yoshihito Nishioka’s brave challenge to lead Spain into the ATP Cup quarter-finals on Wednesday.

The 19-time Grand Slam winner made 36 unforced errors before beating Japan’s Nishioka 7-6 (7/4), 6-4 in two hours and seven minutes.

Unbeaten Spain — who won the revamped Davis Cup in Madrid in November — finished top of Group B with world number 10 Roberto Bautista Agut downing Go Soeda 6-2, 6-4 to secure the tie.

Nadal has yet to drop a set but he looked sluggish at times ahead of the Australian Open, where he aims to equal Roger Federer’s record tally of 20 Grand Slam titles.

The long exchanges against an unwavering Nishioka seemed to take a physical toll on Nadal, who appeared weary in Spain’s first day-session tie in the hot Perth conditions.

“It’s the first time I played under these heavy conditions, so the feeling on court is completely different,” Nadal said.

“I played against an opponent who has started the season on fire.”

Nadal struggled to find his rhythm against the defensive prowess of 24-year-old Nishioka, who counter-attacked superbly to break twice in an engrossing first set, but couldn’t close it out in the 10th game.

Nadal capitalised and drew first blood after claiming a tense tie break.

The 33-year-old remained under pressure in the second set and was forced to fend off three break points in the sixth game, before eventually pulling away.

Japan surprisingly finished second in Group B after world number 13 Kei Nishikori and Yasutaka Uchiyama, their third-best player, withdrew before the tournament and they are still in the mix to advance to the knockout stages in Sydney.

World number 72 Nishioka has steadily become a fan favourite after earlier beating higher-ranked players Nikoloz Basilashvili and Pablo Cuevas.

In the earlier singles, world number 10 Bautista Agut has had a soft start to the season, losing just three games against ATP Tour debutants Franco Roncadelli and Aleksandre Metreveli.

He was made to work harder against world number 119 Soeda, but proved far too strong and broke three times in the 79-minute match.

“I’m happy about the way I played today, as it was my first match (this season) in the heat in Australia,” he said.

Uruguay play Georgia in the later Group B tie with both teams out of contention.