ST. LOUIS -- Ryan Sweeney and Cody Ransom hit back-to-back homers in a four-run first inning and that was plenty for Jeff Samardzija, who pitched the Chicago Cubs over the St. Louis Cardinals 4-2 Tuesday night.
Chicago started fast against Adam Wainwright (10-4) and broke a five-game losing streak in St. Louis.
Pinch-runner Shane Robinson was called out for interference while trying to break up a double play to end the game.
Carlos Beltran hit his team-high 17th homer for the Cardinals, who lost for the third time in five games but still lead the majors with a 45-26 record.
Samardzija (4-7) gave up two runs and seven hits in 8 1-3 innings. He struck out six and walked one for his first win since May 27, a 7-0 shutout against the Chicago White Sox.
The Cardinals cut the lead to 4-2 on an RBI single by Yadier Molina with one out in the ninth.
Kevin Gregg got David Freese to ground into a game-ending double play for his 10th save in as many opportunities. Robinson interfered with shortstop Starlin Castro on the pivot at second base.
Wainwright was trying to become the majors' first 11-game winner. The Cubs tied a season high with four runs in the first -- they also did it in the first inning of a 10-7 loss to San Francisco on April 14.
Wainwright gave up back-to-back homers for the third time in his career. He allowed four earned runs on seven hits over seven innings.
Wainwright had won his previous five starts, but has not beaten the Cubs since Sept. 24, 2010. Wainwright, who bounced back to retire 12 in a row, had given up a total of four first-inning runs over his first 14 starts this season.
The Cubs' first-inning runs all came after two outs. Nate Schierholtz and Alfonso Soriano hit consecutive doubles before Sweeney unloaded with his second homer of the season to make it 3-0. Ransom followed with his eighth homer.
Samardzija never let a runner past second base in the first five innings and was helped out by three double plays.
Beltran homered off the right-field foul pole with two outs in the sixth. Molina went 3 for 3 and leads the NL with a .363 average.
NOTES: Schierholtz has hit safely in a career-best 10 straight games. ... St. Louis OF Jon Jay has gone 215 successive games without making an error in center. He is second in team history behind Curt Flood (226). Jay last made an error on Aug. 24, 2011. His streak is the longest current run in the NL. ... Chicago signed LHP Rob Zastryzny, their second-round draft choice. ... St. Louis rookie right-hander Shelby Miller (8-4, 2.08) left after five innings of Monday's 5-2 win due to cramps caused by dehydration. He will not miss a start. ... Chicago pitchers have a league-leading 22 RBI this season ... The Cardinals signed LHP Rob Kaminsky, their second first-round selection. The 28th overall pick, Kaminsky is from St. Joseph's Regional High in Englewood Cliffs, N.J.