David Carpenter (4-4) took the loss after allowing an unearned run to cross. Jordy Mercer led off with a single and Starling Marte's fly ball to left-center advanced him to third, where Mercer tagged up on Sanchez's flyout.
Pittsburgh's win snapped a seven-game losing streak, and ended Atlanta's five-game winning streak.
Upton drove in a run with a single in the first inning after Jason Heyward walked and Freddie Freeman singled. Upton's single extended his hitting streak to 11 games.
After allowing a double to Evan Gattis leading off the second, Pittsburgh right-hander Gerrit Cole retired the next 12 batters he faced before Heyward singled in the sixth.