SAN DIEGO (AP) -- Even blowing a six-run lead late in the game couldn't stop the San Diego Padres.
Rookie Yonder Alonso singled in the ninth inning to drive in the winning run and cap a wild offensive game, leading the Padres to a 12-11 victory over the Colorado Rockies on Sunday.
Colorado scored six times in the eighth inning, tying the game on rookie Josh Rutledge's grand slam.
The Padres won for the 19th time in 25 games. San Diego won its sixth straight home series and has gone 23-7 at Petco Park since just after the All-Star break.
San Diego is playing with so much confidence that they think they are still players in the NL wild-card race. The Padres are 5 1-2 games back with 15 games to play and four teams between them and the final berth.
''Why not,'' Alonso asked. ''We feel good about ourselves and where we are headed.''
While the odds are stacked heavily against a wild-card bid, San Diego is a team no other club wants to play right now.
''That team is playing some fantastic baseball,'' Rockies manager Jim Tracy said.
In the ninth inning, Everth Cabrera reached on a one-out infield single against Matt Belisle (3-7). With two outs, Belisle balked Cabrera to second and then intentionally walked Chase Headley to bring up Alonso.
The left-hander lined a ball right at left fielder Andrew Brown, whose throw was slightly late as Cabrera slid across home plate with the winning run and start the celebration.
''The first guy I saw (after the hit) was Chase coming at me,'' Alonso said. ''I was like, 'Oh boy, here we go.' I was kind of backing away because I knew I was going to get it.''
Joe Thatcher (1-4), who came on to strike out the final two batters with runners on first and second in the ninth, picked up the win.
The clubs combined for 23 runs and 27 hits.
Trailing 11-5 after San Diego scored eight runs in the fifth, the Rockies used their own big inning against three rookie relievers to get back in the game.
''I don't like roller coasters,'' Padres manager Bud Black said. ''Every now and then you have to take one. You have to take the ride, and we did. We ended up OK.''
After Cory Burns started the eighth and allowed a run on two hits and an error, Tommy Layne came in and hit Charlie Blackmon with a pitch to load the bases.
Layne then walked Dexter Fowler to force in another run before being replaced by Nick Vincent. Rutledge hit Vincent's first pitch into the left-field stands to tie the game at 11.
''We just kept battling, every guy,'' Rutledge said. ''Every guy who went to the plate had good at-bats, and we were just trying to string some runs together.''
John Baker's two-run single with two outs off Rockies reliever Adam Ottavino in the fifth tied the score at 5. Pinch-hitter Andy Parrino followed with an RBI single to put San Diego ahead.
Cabrera, who had three RBIs, lined a two-run double into the right-field corner. He then stole third and scored on catcher Jordan Pacheco's throwing error.
After Logan Forsythe's infield single brought on reliever Matt Reynolds, Headley hit a two-run homer to left to cap the inning.
''I made some bad choices along the way,'' Ottavino said. ''I didn't do my job. The pitches I make that were good they hit hard. My seven runs were a major contribution to (the loss).''
Headley extended his career highs with his 28th homer and 104 RBIs, tops in the NL. Headley leads the majors with 20 home runs and 62 RBIs since the All-Star break.
NOTES: Tracy said if LHP Jorge De La Rosa checks out medically, he would start at least once in the final 17 games. De La Rosa, who made his third rehab start Saturday night, hasn't pitched in the majors since he underwent Tommy John surgery in June 2011. .. Black said there is no timetable for when LF Carlos Quentin (sore right knee) might return to the starting lineup. Quentin has missed five start starts. .. Rockies RHP Jhoulys Chacin (2-5, 4.86) opposes Giants LHP Madison Bumgarner (14-10, 3.32) in the opener of a three-game series on Monday night. .. After a day off, Padres LHP Eric Stults (6-2, 2.54) will face Diamondbacks RHP Ian Kennedy (13-11, 4.21) in the first of three at Arizona on Tuesday night.