HOUSTON -- Making his final career start 20 minutes from his home in Deer Park, Texas, the New York Yankees' Andy Pettitte finished off a five-hitter by retiring J.D. Martinez with the crowd of 37,199 standing on its feet and many chanting the left-hander's name at Minute Maid Field on Saturday night.

With camera flashes dotting the crowd and two outs in the ninth, Pettitte allowed a single to Chris Carter, bringing Yankees manager Joe Girardi out of the dugout. With the fans thinking he might lift Pettitte, they booed.

Before the inning, the 41-year-old Pettitte had told Girardi if a man reaches, bring in the "kid," referring to 28-year-old reliever David Robertson, who was the Yankees' closer on Saturday with Mariano Rivera announcing earlier he never would pitch again. When Girardi reached the mound, he told Pettitte, "It is your call."

"I said, 'I want to try and finish this thing,' " Pettitte said. "So he just walked off and that was it. It is usually never my call."

Pettitte retired Martinez on a groundout to third to complete the 2-1 Yankees' win.

Pettitte allowed just the one earned run on five hits, striking out five and walking two in his first complete game since 2006 (a span of 169 starts).

In what he and Girardi described as a "playoff-like atmosphere," Pettitte threw a season-high 116 pitches.

"It's probably been about 15 years since he's done it," Derek Jeter said. "I told him, 'He is probably going to go see Dr. Andrews after the game.' But I'm happy for him, that he was able to pitch like that in his last game."

Andy Pettitte capped his baseball career with a complete-game win to finish his final season at 11-11 with a 3.74 ERA. Scott Halleran/Getty Images

After the final out, Pettitte had a wide grin on his face as he received a long line of hugs from teammates. Most of the crowd stayed and continued to chant his name. He continued to hear applause, and the Astros left their dugout to join in as the stadium was filled with, "Andy, Andy, Andy."

"I couldn't have dreamed of this to work out the way it did," Pettitte said, who cried during his news conference as his wife and four children looked on. "I'm just so thankful, so blessed and fortunate. I just feel as if God worked this out exactly perfect. Another day that I'll never forget."

Pettitte finished his final season 11-11 with a 3.74 ERA. He never had a season in which he finished below .500. His career record ends up at 256-153.

During the final stretch of the season, Pettitte was the Yankees' best pitcher. In the last 10 starts of his career, he allowed three runs or less and his ERA was 1.94.

"You think of how he pitched the last two months, he was as good as he's been," Girardi said. "When we need him the most."

When the schedule came out, Pettitte noticed that the Yankees were finishing the regular season 20 minutes from his home, but hoped he would be prepping for the playoffs, not finishing out his career in front of friends and family. That is what Pettitte had grown accustomed to doing with the Yankees.

Pettitte owns the most postseason victories in history with 19. In his 44 playoff starts -- the most for any pitcher -- he was 19-11 with a 3.81 ERA. He owns five World Series rings, all won with the Yankees.

This is Pettitte's second retirement. He first shut it down after 2010. He sat out the 2011 season, but Yankees general manager Brian Cashman asked him to return the following winter. Pettitte toyed with the idea before finally deciding to come back during spring training of 2012. He went 5-4 with a 2.87 ERA, but his season was cut short after being nailed by a batted ball during his ninth start of the season.