Samardzija (4-7) allowed a pair of runs on seven hits, walking one and striking out six en route to his first victory since May 27.
Sweeney's clout highlighted a four-run first inning that also saw Cody Ransom go deep for Chicago.
Alfonso Soriano added an RBI for the Cubs, who bounced back from a 5-2 loss in the Monday opener of their four-game series.
Cards starter Adam Wainwright (10-4) was done in by the big first inning, surrendering four runs on seven hits over seven full frames.
Carlos Beltran went 2-for-3 with a solo homer for National League Central-leading St. Louis.
2014: The Year in Fashion [PHOTOS]
LeBron James reveals his new Nike shoes