San Francisco moved within a percentage point of San Diego in the National League West on Sunday.
And both of those teams were looking back at Colorado, the hottest team in baseball. The Rockies surged within 1 1/2 games of the lead by winning their 10th straight.
In the NL East, Philadelphia, a winner over the New York Mets, took a one-game lead over Atlanta, which lost to St. Louis.
Giants 6, Padres 1 — Tim Lincecum won his third straight start following a career-high, five-game losing streak and had a two-run single for San Francisco.
Premium content for only $0.99
For the most comprehensive local coverage, subscribe today.
The Giants won three of four games after having lost nine of their first 11 against the Padres this year. The teams will meet in a season-ending series at San Francisco Oct. 1-3.
San Diego (80-62) leads San Francisco (81-63) by .5634 to .5625.
Rookie Buster Posey hit a two-run homer off Latos (14-6), who allowed five runs and seven hits in four innings, his worst start since April 26.
Rockies 4, Diamondbacks 2 — Pinch-hitter Jason Giambi hit a two-run homer off Sam Demel (1-1) with two outs in the ninth for Colorado.
Jonathan Herrera started the rally when he reached on an error by second baseman Kelly Johnson. Colorado's winning streak is the longest in the NL this season and one game short of the major-league best shared by the Chicago White Sox and Texas.
Phillies 3, Mets 0 — Roy Oswalt (12-13) pitched a four-hitter for his second complete game this season.
Raul Ibanez hit a solo homer off Jon Niese (9-8), and Chase Utley and Ryan Howard had RBI singles for the Phillies.
Cardinals 7, Braves 3 — Albert Pujols hit two home runs to power St. Louis.
Pujols passed Hall of Famer Stan Musial for the most multihomer games in franchise history with 38, including five this season.
Kyle Lohse (3-7) allowed nine hits but only two runs in 5 1/3 innings to beat Tim Hudson (15-8), who gave up six runs in five innings in his third straight loss.
The second-place Cardinals gained a game in the NL Central but still trail Cincinnati by six games.