The Dodgers trailed 3-2 in the bottom of the eighth when Federowicz came to the plate with one out and laced the first pitch from David Hernandez (2-3) into the left field corner to bring in the winning runs.
Andre Ethier put Los Angeles on the board in the sixth inning with a two-run homer. Matt Gurrier (2-2) earned the win in relief and Kenley Jansen got his first save since being formally anointed as the Dodgers closer earlier in the day.
Greinke was in the middle of a beanball duel that began when Dbacks' starter Ian Kennedy hit high-profile Los Angeles rookie Yasiel Puig in the head in the sixth inning. Greinke hit Miguel Montero in the seventh inning and was himself plunked in the bottom of the seventh.
A bench-clearing confrontation followed resulting in the ejection of Puig, Arizona Manager Kirk Gibson and three other players and coaches being sent to the showers.