Salah, who has not been at his best since returning from injury last month, was brought on in the 79th minute, just after the Hammers' second goal levelled the game
With his record-improving 13th triumph at Roland Garros, world number two Nadal is now tied with Swiss Roger Federer as the player with the most men's singles major titles.
Djokovic, who was looking to win his 18th Grand Slam title, rebelled in the third set, breaking back for 3-3, only to drop serve on a double fault in the 11th game before Nadal went on to bag his 100th victory at Roland Garros with an ace.