Top seed and six-time champion Federer held off David Goffin 6-3, 3-6, 6-1 to win a re-run of his 2014 final victory over the Belgian.
Nadal, the third seed, scored a hard-fought 4-6, 6-3, 6-3 triumph over Marin Cilic, his third three-set victory this week.
Goffin showed off a big game, duelling with the Swiss in the second set and coming out ahead 4-2 after a run of three consecutive breaks of serve.
The Belgian, who idolised Federer as a teenager, sent the match into a deciding set but immediately lost his momentum as the 34-year-old Swiss star broke in the second and sixth games before serving out the win in front of 9,000 fans.
“I thought I had it under control after the first set, but he really lifted,” said Federer, who Saturday plays Jack Sock, a winner over fellow American Donald Young 5-7, 6-4, 6-2.
“He played the second set much better. I’m happy to get through over such a dangerous opponent.
“I knew his game after we practised together in Dubai in December, we put in 10-15 hours on the court, played tons of sets.
“He’s a great player with the footwork, the power, the tennis IQ.”
Nadal, the 14-time Grand Slam champion, will next face France’s Richard Gasquet who survived 32 aces from Ivo Karlovic to keep his hopes of a World Tour Finals place alive with a 6-4, 6-7 (2/7), 7-6 (8/6) win.
Nadal began turning his match with 2014 US Open champion Cilic on its head after going down a set and a break.
The Spaniard retrieved the break in the fourth game, 2-2, with a forehand winner.
He then took a 5-3 lead as Cilic delivered three double-faults to lose serve in an eight-minute game, opening the door for Nadal to push through.
With the sets level, Nadal went to work closing out the evening, breaking to start the third and concluding with another break as the Croatian ended with seven double-faults while losing serve four times in two and a quarter hours.
“I was just fighting, always trying to find solutions in a difficult situation,” said Nadal.
“He played a great first set and it was tough to find any chances on return.
“I changed my position (on return) a bit in the second set and it seemed to work well. This was an important victory for me against someone playing very well.”
Cilic fired 37 winners but was undone by 49 unforced errors and is now 0-11 against top 10 players since winning the 2014 US Open.
The 29-year-old Nadal’s confidence is fast returning after a slow start to 2015 and some indifferent play in the ensuing months when his ranking slumped to a 10-year low.
“I needed to play with the right tactic and motivation and try to improve every day,” said Nadal.
“It’s not easy but I’m working hard to find the feelings and find the mental strength to come back.”
Nadal has already qualified for the World Tour Finals to be staged in London from November 15 along with Novak Djokovic, Federer, Andy Murray, Stan Wawrinka and Tomas Berdych.
Gasquet is chasing one of the last two spots remaining in the eight-player finale.
But the Frenchman with the picture-book, single-handed backhand faces almost impossible odds, needing to win the Basel title this weekend and next week’s Paris Masters.
Anything less will send rivals Kei Nishikori and Spain’s David Ferrer to the year-end showpiece.