The Rockies, who at one point held a 7-3 advantage, allowed the Padres to score the next six runs and found themselves trailing 9-7 entering the bottom of the seventh.
But Tommy Layne hit Carlos Gonzalez with a pitch to lead off the half-inning, then surrendered a single to Jordan Pacheco. Tyler Colvin moved the runners up with a sacrifice bunt before Layne was lifted in favor of Brad Brach (1-4).
That brought up Nelson, who blasted a 1-1 pitch over the center field fence for a three-run shot to hand the Rockies the lead for good.
The big blow made a winner of Guillermo Moscoso (1-1), who had worked out of a two-on, two-out jam in the top of the seventh.
Colvin and Ramon Hernandez each supplied two-run homers for Colorado, which took two of three from San Diego.
Chase Headley drove in a career-high six runs for the Padres, going 4-for-5 with a two-run home run.