This was Greinke's fifth start since missing more than a month of the season with a broken collarbone and he had given up at least four earned runs in each of his previous three appearances.
Greinke (3-1) allowed just four hits and struck out seven over seven innings in this one, after which Kenley Jansen and Matt Guerrier completed the shutout.
The excellent start from Greinke was needed to protect what was only a one-run lead for most of the game, but the Dodgers broke it open in the eighth when Puig launched his grand slam to right field off Cory Gearrin.
The game's only other run came when Scott Van Slyke raced home from third when Skip Schumaker grounded out to second in the second inning.
That run was charged to Tim Hudson (4-5), who surrendered four hits and did not walk a batter in seven frames.
2014: NFL Cheerleaders [PHOTOS]
Michael Sam cut from the Dallas Cowboys