HOUSTON (AP) -- When Andy Pettitte envisioned how his final start would play out, he imagined a lot of scenarios.
Pitching a complete game was definitely not one of them.
But the 41-year-old left-hander did just that, throwing a five-hitter for his first complete game since 2006 to lead the New York Yankees over his hometown Houston Astros 2-1 on Saturday night.
''It couldn't end any better,'' Pettitte said, trying to hold back tears.
Two days after Mariano Rivera's finale in front of an emotional crowd at Yankee Stadium, Pettitte followed his teammate into retirement and left only Derek Jeter left from the Core Four who earned five World Series rings with the Yankees since 1996.
Pettitte said the last week of this season has been difficult for him.
''It's been terrible because I know it's over,'' Pettitte said. ''It's a shame you get old.''
Chris Carter singled with two outs in the ninth, ending a string of 11 straight batters retired by Pettitte. Yankees manager Joe Girardi came to the mound, had a brief conversation with Pettitte, then returned to the dugout.
Girardi said he left it up to Pettitte as to whether he wanted to stay in the game.
With the crowd on its feet and cameras flashing, J.D. Martinez hit a game-ending groundout to third baseman Eduardo Nunez, giving Pettitte his 26th complete game.
Pettitte, who lives in suburban Deer Park, lingered on the field as teammates hugged him - including Jeter, Rivera and Girardi, Pettitte's former catcher.
The Astros stood in front of their dugout, applauding, and fans chanted ''An-dy! An-dy!''
''I don't know how to even take you through it, except I just felt like I wasn't even worthy to have that happening to me,'' Pettitte said.
Houston extended its team-record losing streak to 14 with its 110th loss of the season.
The oldest starting pitcher in the major leagues, Pettitte finished this season 11-11 and never had a losing record in 18 major league seasons. He was 256-153 with a 3.85 ERA and 2,448 strikeouts during the regular season and excelled in October, where he compiled a record 19 postseason wins.
It was a week of nostalgia for the Yankees. Rivera, the 43-year-old career saves leader, was given an emotional home sendoff Thursday night and said Saturday afternoon that he wouldn't pitch during the season-ending series against the Astros.
''I told Mo I might finish the game off if you're not in the bullpen,'' Pettitte said.
Rivera was ecstatic that Pettitte finished his career with a complete game.
''I was pulling for him, knowing that he was there alone,'' Rivera said. ''This was his game and we just had to cheer for him, and that's what we did - that's what I did.''
Girardi compared Rivera's last appearance to Pettitte's night.
''It was a different feel,'' he said. ''Mo's was about honoring a man that had meant so much, but this really felt like a playoff game, because we wanted this for him so bad.''
Pettitte struck out five and walked two in a 115-pitch effort, allowing his only run on Carter's RBI groundout in the fourth. With a sharp slider and cutter, he kept the Astros to 0 for 11 with runners on base.
''I couldn't have dreamed this would have worked out the way it did,'' Pettitte said. ''I'm so thankful and fortunate and blessed and I just feel like God worked this out exactly perfect. Just another day that I'll never forget.''
Robinson Cano hit an RBI single in the sixth inning, and New York took the lead when Nunez scored on an embarrassing error later in the inning by catcher Matt Pagnozzi, who accidentally spiked the ball while trying to throw to second on an attempted pickoff.
''I didn't have a grip and I was trying to stop my arm and what happened, happened,'' Pagnozzi said. ''It's pretty tough, especially with the kind of skid we're on right now. Having it come down to being the go-ahead run that scored. Yeah, not something that you want to happen.''
Numerous friends and family of Pettitte were on hand, including former Houston teammate Jeff Bagwell. The pair exchanged a hearty embrace before Pettitte took the mound. Making his 438th start for the Yankees, he tied Whitey Ford's team record.
''It was fitting,'' Jeter said. ''It's funny how things work out sometimes. I know he's had some good memories here. He's from here. It was special for him to do it in front of Yankee fans, as well as the Houston fans.''
NOTES: The Astros' 323 losses over three seasons are tied with the 1940-42 Philadelphia Phillies for fourth-most in big league history according to STATS, ahead of only the 1962-64 New York Mets (340), the 1963-65 Mets (332) and the 1915-17 Philadelphia Athletics (324). ... Houston starter Paul Clemens allowed two runs and five hits in 5 1-3 innings. ... Yankees 3B Alex Rodriguez said Saturday that he didn't expect to play this weekend because of soreness in his legs.