The Reds overcame an early two-run deficit to win their fourth in a row.
Cincinnati took the lead with a three-run seventh that featured the two RBI from Hanigan. A sacrifice fly from Zack Cozart delivered the third run of the inning and Ryan Ludwick's run-scoring triple in the eighth closed out the Cincinnati scoring.
Alfredo Simon (1-1) threw two scoreless innings of relief to get the win. Aroldis Chapman gave up a hit in the ninth but also struck out the side to claim his 12th save.
The loss went to starter Adam Wainwright (7-9), who was unable to hold the lead in a 6 1/3-inning effort. He gave up four runs on five hits.
St. Louis had won six of eight to close out the first half of the season.
Beautician charged with giving client fatal silicone butt injection
Duggar sisters unveil Christian dating rules in new book