Dimitrov battled hard in the final set but Nadal was keen to avoid going the distance once more and took the final set 6-3.
Federer, playing his first tournament since losing to Juan Martin del Potro in the quarter-finals of the US Open, later breezed through with a 6-4 6-2 win over Alexandr Dolgopolov.
Visit the official Shanghai Masters website for a look at the results and schedule in full.
But the Bulgarian, who sent down 13 aces in the match, took the fight to the Spaniard in the second set, coming from 3-0 down in a tie-break to level.
The two friends headed into a deciding set with Dimitrov in the ascendancy and the pro-Nadal crowd fearing an upset.
"I played a very good match, I don't know how many mistakes I made, but very few", said the 16-time Grand Slam victor and top seed in Shanghai.
Dimitrov sensed another opportunity in the fifth game of the third set, but Nadal survived the break point.
Earlier on Friday, an imperious performance from Cilic saw him become the competition's first player to claim a semi-final spot and improve his 2017 record to 39 wins and 16 defeats with a third successive straight-sets win.
Nadal served out the set and had a chance to gain the upper hand in the second, but Dimitrov saved a break point before taking a 3-2 lead and the pumped-up sixth seed clenched his fist upon winning his next service game.
Nadal, who didn't lose serve in his two-and-a-half-hour win, will face fourth seed Marin Cilic in the semi-finals.
And he underlined his status as the man to beat in Shanghai as he battered the Italian Fognini 6-3, 6-1.