The world number two had produced a scrappy display against Leonardo Mayer on Wednesday, losing a set for the first time in four years at the tournament, but he showed more spark and composure against Ferrer.
Nadal broke the 37-year-old Ferrer, who will retire from the game next month after the Madrid Open, in the sixth game to take a 4-2 lead in the opener but play was halted due to rain with the score at 5-3.
Nadal promptly saw out the set when play resumed and broke Ferrer in the first game of the second but then lost a service game, which made it 2-2.
Thiem stuns Nadal to reach Barcelona final
The Mallorcan broke again and then took a 5-3 lead, spurning three match points due to two marginal calls which left him visibly annoyed with the line judge.
Nadal finally closed the match out at the fourth opportunity as Ferrer could only find the net.
Nadal led fans in applauding Ferrer as the defeat signalled his last appearance at the Barcelona Open.
"Losing to Rafa makes me proud, I'm happy with the game as I did what I could, I gave everything I had but I tip my hat to Rafa," Ferrer said.
"It was difficult, I started well but the court was slower when the rain started coming down, that damaged me but I still played a competitive game."
Nadal paid tribute to Ferrer, who he beat in the 2013 French Open final, and was pleased with his own display.
"It's his decision but on a tennis level he doesn't have to retire, he's struggled with injuries but he is playing very well this year. After all his years fighting and giving us all joy he deserves the reception he got," Nadal said.
"I had to improve on yesterday, not just the result but overall. This was important for David but for me it was important to do better and play with more energy than yesterday I did that so I can go back to my hotel feeling much happier."