The top-ranked Djokovic, seeking his fourth consecutive title in Dubai, wasn't at his best for a second straight match after struggling against Cedrik-Marcel Stebe in the opening round. The Serb hadn't played in a tournament since winning the Australian Open.
Stakhovsky was 4-3 up in the first-set tiebreaker, but two costly unforced errors let Djokovic off the hook, and he took the set when the Ukrainian hit a forehand long.
"The difference between the top players and maybe the lower-ranked players is actually those moments," Djokovic said of his comeback. "And managing to keep your composure and cope with the pressure and just focus, have an extra focus, mental strength."
Federer broke Lopez in the final game to end a tight opening set. The second set was more routine, with the Swiss breaking the Spaniard for a 5-3 lead before closing the match with a volley from the net.
Federer, who was beaten in the Dubai final last year by Djokovic, is going for his fifth title and second in 2012 after winning in Rotterdam.
"It was tough getting used to his serve early on. I wasn't having many looks -- he was serving aces left and right," said Federer, who won 92 percent of his points on first serve.
In a reprise of the 2007 final, Federer will next face Youzhny, whom he has never lost to in 11 meetings.
Fish's loss was another setback to what has already been a disappointing start to 2012.
After replacing Andy Roddick as the top-ranked American last year, Fish has struggled. He lost in the second round of the Australian Open and was beaten by 388th-ranked Albano Olivetti in the Marseille quarterfinals last week. He did, however, help the United States rout Switzerland 5-0 in the Davis Cup.
"It's no disgrace to lose to someone like him, but it's frustrating to lose," Fish said. "I had a rough trip, last couple of matches did sting a little bit going into Indian Wells and Miami."
Murray broke Chiudinelli early in the first set and moved him around the court with ease. The second set was closer as both players held serve for the first eight games. But Murray broke to lead 5-4, winning the match on a powerful serve Chiudinelli couldn't return.