Samardzija pitches Cubs past Cardinals 4-2St. Louis Cardinals starting pitcher Adam Wainwright, left, watches as a solo home run by Chicago Cubs' Cody Ransom, right, clears the left field wall during the first inning of a baseball game on Tuesday, June 18, 2013, in St. Louis. (AP Photo/Jeff Roberson)
ST. LOUIS (AP) -- Jeff Samardzija hopes his traditional June swoon is a thing of the past.
Samardzija picked up first career win as a starter in his most unlucky month, tossing 8 1-3 strong innings to help the Chicago Cubs to a 4-2 win over the St. Louis Cardinals on Tuesday night.
Samardzija (4-7) came into the contest winless in eight June starts - he was 2-8 with a 7.14 ERA, with both victories coming in relief.
''I really want to knock this June bugaboo,'' he said. ''I've been working really hard and I like where I am today.''
Samardzija gave up two runs on seven hits and left with a 4-1 lead. He struck out six and walked one for his first win since May 27.
Ryan Sweeney and Cody Ransom hit back-to-back homers in a four-run first as Chicago broke a five-game losing streak in St. Louis.
The Cubs started fast against Adam Wainwright (10-4) and won for the fourth time in six games.
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.
Cubs manager Dale Sveum was especially impressed with his starter.
''He was as good as he's been all year against the best offense in baseball,'' he said. ''If you can do that to them, you've had one heck of a game.''
Said Sweeney: ''Watching from center field, he was unbelievable.''
''He was keeping hitters off balance and still throwing 96 to 97 (mph) in the ninth inning,'' he said.
Kevin Gregg picked up his 10th save in as many opportunities. He got David Freese to ground into a strange game-ending double play. Pinch-runner Shane Robinson was called out for interference while trying to break up the play at second.
Robinson was ruled to have gone out of the way to hinder the relay throw from shortstop Starlin Castro.
St. Louis manager Mike Matheny agreed with the call by umpire crew chief Fieldin Culbreth.
''He got it right,'' Matheny said. ''It's just frustrating to see the game end like that.''
The Cardinals cut the lead to 4-2 on an RBI single by Yadier Molina with one out in the ninth. Matt Holliday and Allen Craig singled with one out to chase Samardzija.
Gregg, after giving up the hit to Molina, induced Freese to hit a hot shot right at second baseman Darwin Barney, who started the double play.
Freese hit into three double plays and also struck out.
The Cubs' first-inning runs all came after two outs. Nate Schierholtz and Alfonso Soriano hit consecutive singles before Sweeney unloaded with his second homer of the season to make it 3-0. Ransom followed with his eighth homer.
''We just got on them early,'' Sweeney said. ''Thankful enough that we did. If you don't get to a guy like that, he'll bear down and then you can't score any runs.''
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, who was trying to become the majors' first 11-game winner, 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. He had given up a total of four first-inning runs over his first 14 starts this season.
''It was unforgivable,'' Wainwright said. ''I put my team in a really tough spot.''
Samardzija never let a runner past second base in the first five innings and was helped out by three double plays.
''What else can you ask for?'' Samardzija said. ''Great defense. And the icing on the cake were those four runs in the first.''
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 .367 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.