Federer, bidding for his maiden title in Rome having lost three finals -- two to Nadal -- earned three break points in the third game of the second set and won the game when Wawrinka attempted a wild half-volley from a tight angle which he netted.
Federer moved 3-1 up on his next service game and broke his fellow Swiss again for a 4-1 lead before wrapping up the set.
So far this year it's one apiece between Djokovic and Federer, the former winning their last final at Indian Wells on a hard surface to make amends for Federer's hardcourt win in Dubai.
Career-wise, Federer holds the advantage with 20 wins to Djokovic's 18, although the Serb has shown glimpses of brilliance this week and a variety of shots that put all of his rivals in trouble.
Earlier, the Serbian swept clay court specialist David Ferrer aside in straight sets, breaking the Spaniard once in each set to secure his chance for a fourth crown in Rome.
Djokovic said he felt encouraged by a performance in which he held serve against "one of the best returners in the game".
But he admitted he had been fortunate on more than one occasion to dig his way out of trouble.
"I did face a couple of break points, especially in the second set, when maybe I was a bit fortunate to dig my way through and up, and play well enough to break him in both sets when it was most needed," said Djokovic.
"Compared to previous matches that I played here this week, this is definitely the best match so far and the performance is satisfying and giving me enough reason to believe I can play at this level and maybe even better tomorrow."
Ferrer's failure to pounce on the break point chances he had worked so hard to earn ultimately proved his downfall.
The Spaniard said: "I served very good this week and I've had good percentages but I have to take my chances when I get them.
"I think I had one break at 5-4 in first set, then 3-2 for me in second I had two break points which I didn't make.
"Against the number one in the world it's very difficult to win if you don't take those chances."
-AAP