Ransom socked a solo homer in the second inning and delivered a one-out single in the sixth, driving in Alfonso Soriano to break a 3-3 tie.
The Cubs third baseman then came around to score on Darwin Barney's double, capping the game's scoring.
Barney also notched an RBI double and Scott Hairston bashed a bases-empty shot for Chicago, which registered a fifth win seven games.
Michael Bowden (1-1) earned the decision in relief of Jeff Samardzija, who yielded three runs over five full innings.
Kevin Gregg turned in 1 1/3 scoreless innings to pick up his fourth save as the Cubs took the opener of a four-game home series.
San Diego's Clayton Richard (0-3) was tagged for all five runs on seven hits over 5 2/3 frames.
Yonder Alonso drove in two runs for the Padres.