SAN FRANCISCO (AP) Matt Cain needed this kind of outing. The former Giants ace has struggled with injuries and ineffectiveness since throwing his perfect game more than three years ago.
Cain started for the first time in six weeks and pitched two-hit ball for five scoreless innings. He was in line for his 98th career victory before the Colorado Rockies rallied for seven runs in the ninth inning to beat the San Francisco Giants 7-3 on Sunday.
''I can feel good about the offseason and wipe the slate clean,'' Cain said. ''I can reflect back on making certain big pitches, if I was worried about technique or my mental state. I won't have to worry about rehab. It will be about getting rest and letting my elbow heel.''
Cain finished 2012 with a 16-5 record and a 2.79 ERA. He did not miss a start through his first eight years. He's endured injuries and command problems ever since, recording a 12-21 record with an ERA hovering near 4.50.
That might have changed with one good outing, his first start in six weeks.
''He should take away that he's back,'' Giants manager Bruce Bochy said. ''What a great job he did against that lineup. He should be really encouraged. An outing like that should do so much for him.''
Corey Dickerson hit a three-run homer and Justin Morneau and Charlie Blackmon each delivered two-run hits to spoil Cain's day.
''It was a crazy day with everything happening,'' Cain said of a pregame ceremony to honor the retiring Jeremy Affledt. ''I tried to take it all in. I wanted to be a part of it. The day belonged to him.''
The Giants wound up using 11 pitchers. They took a two-hit shutout into the final inning before the Rockies rallied.
This season, Carlos Gonzalez and third baseman Nolan Arenado combined to hit 82 home runs and drive in 227 runs, the most productive duo in Rockies history since Todd Helton and Larry Walker combined for 87 homers and 269 RBIs in 2001.
''It's unfortunate our record wasn't better and him not being considered one of the favorites for that MVP award,'' Morneau said of Arenado. ''I still think he should be. What he meant to this team both offensively and defensively, I don't think there's anybody who does what he does on both sides of the baseball. He's the best defensive third baseman I've ever seen.''
The Giants finished 84-78, a year after winning 88 games in the regular season and going on to take their third World Series title in five seasons.
Rex Brothers (1-0) pitched a scoreless eighth for the win. George Kontos (4-4) took the loss.
Buster Posey drove in his 95th run for the Giants, who won the NL wild-card game last season.
Rockies closer John Axford walked two, sandwiched around a double, to load the bases in the ninth. He struck out Matt Duffy and got Posey to ground out to end the game.
The Rockies finished the year with 68 victories, two more than last year. It was their fifth straight losing mark.
Affeldt, who announced his retirement last week, recorded the first two outs of the sixth before leaving to a standing ovation.
Affeldt hugged manager Bruce Bochy and the gathered infielders before heading off the mound for the final time and acknowledging the fans.
The Giants recorded their 408th consecutive sellout, the longest active streak in the majors. They drew 3,375,882 this year, 7,285 more than in 2014.
San Francisco, which clinched the NL team batting crown, started six rookies.
Rockies: C Tom Murphy underwent an MRI on his left shoulder. It showed no structural damage, but confirmed a mild strain and also revealed a contusion.
Rockies: Opens the 2016 regular season on April 4 at the Arizona Diamondbacks.
Giants: Cactus League opener on Wednesday, March 2 vs. Los Angeles Angels at Scottsdale Stadium.