The Pirates ended a four-game losing streak and expanded their lead over the Cardinals in the National League Central to three games. They have split the first two games of a series that will end Thursday.
Liriano (13-5) took a shutout into the ninth inning before giving up a run on a ground out by Carlos Beltran. It was Liriano's second complete game this season. His only other one came in 2011 while with Minnesota.
Pittsburgh took the lead in the second on solo homers from Pedro Alvarez and Garrett Jones. The Pirates struck for three more in the fourth on an RBI single by Gaby Sanchez and a two-run double by Starling Marte.
Shelby Miller (11-8) was charged with the loss after giving up five runs, three of which were earned, on eight hits in six innings.