Greinke (9-3) broke a personal three-start winless streak, holding the Cardinals to two runs on eight hits over 6 1/3 innings. The right-hander walked one and struck out four.
He also supplied a two-out, run-scoring single in the top of the seventh, giving the Dodgers a 3-1 lead.
Ronald Belisario got the last two outs in the bottom of the inning after Greinke surrendered a run and Paco Rodriguez finished up with two scoreless innings for his second save.
With the club-record 15th consecutive road win, the National League West-leading Dodgers are within two of the all-time NL mark held by the 1916 New York Giants.
Andre Ethier and A.J. each drove in a run for Los Angeles.
Adam Wainwright (13-7) absorbed the loss, allowing three runs on seven hits over seven innings.