San Francisco loaded the bases with two out in the top of the first inning and got its first run when Justin Germano (2-5) hit Hector Sanchez with a pitch.
The next batter, Nady, laced an 1-0 pitch down the third base line and into the left field corner, scoring Buster Posey, Hunter Pence and Sanchez for a 4-0 lead.
Tim Lincecum (8-14) held the Cubs to a pair of runs on four hits over 6 1/3 innings to earn the win. The right-hander walked three and struck out seven.
Germano ended up allowing five runs on six hits over five frames.
David DeJesus socked a two-run homer for the Cubs.
Celebrity Families of 2014 [PHOTOS]