“I prayed about it with my wife and my kids and I felt like it was something that God wanted me to do,” Andy Pettitte, 40, said of his comeback with the Yankees this season. The left-hander has a 2.77 ERA over his first seven starts. (Jonathan Newton/The Washington Post)

It was Andy Pettitte’s birthday — his 40th — an occasion he has celebrated for nearly the past 20 years in clubhouses like the one where he stood last Friday afternoon at Nationals Park. But this one was a bit different.

As he begins this decade, the starting pitcher for the New York Yankees is just a few months removed from retirement. A year ago, he was coaching his son’s youth baseball team.

The media members gathered in front of his locker and Pettitte joked that his age hadn’t caught up with him yet. He felt the same as he did the previous day, he said.

“So, you felt 40 yesterday,” one reporter said, drawing a large smile from Pettitte.

Upon reaching the mid-life milestone, Pettitte listed his three main priorities in life. Baseball came in last. A 17-year career marked by three All-Star games, eight 15-win seasons and five World Series rings ranked behind his strong faith and his relationship with his family.

“That’s just what it’s all about. I try to show humility in everything I do” he said. “I felt like God gave me the ability to do this, so why should I be arrogant about this?”

After 16 seasons in the major leagues, Pettitte retired in February 2011. He returned in May and is enjoying his second-best start to a season since 2002.

In seven starts, including the Yankees’ 5-3 win over the Nationals on Saturday in the middle of a three-game sweep, he has fanned 46 batters and posted a 2.77 earned run average. On Friday, Pettitte will try for his fourth win of the season as the Yankees take on the crosstown Mets.

He decided in December to attempt a comeback, but said he didn’t feel confident about it until February. He first pitched from a flat surface, slowly building enough arm strength to throw off the mound. He had worked out only a handful of times during his 11-month retirement.

Although other teams were interested in him, Pettitte said his only choice was the Yankees. He kept in touch with the team’s general manager, Brian Cashman, who told him in January that the team couldn’t wait any longer and had acquired a pair of pitchers. Translation: No more room, no extra money.

“I said ‘I totally understand that,’ ” Pettitte said he told Cashman. “You guys do what you need to do. If the good Lord wants this to happen, it will happen.”

In a tradition for retired Yankees, Pettitte was invited to spring training as a one-week special instructor, along with Reggie Jackson, Ron Guidry and Goose Gossage. Pettitte helped throw batting practice, advised young pitchers and spent time with old teammates. Although he had a new role, the thought of a return didn’t diminish.

Less than a month later, Pettitte signed a one-year, minor league contract with the Yankees worth $2.5 million,a lot less than Cashman’s January offer. He said he never imagined he’d sign a minor league deal, but it was the only way to make the situation work for both parties.

“I prayed about it with my wife and my kids and I felt like it was something that God wanted me to do,” Pettitte said. “And I knew if I was into this, it would work out.”

Pettitte’s year away from baseball was therapy for his mind. By the time he retired, he said he no longer had the drive he needed to train for his job. He didn’t follow baseball closely; instead he spent the summer watching his daughter and two sons play sports.

Discussions with his children and wife, Laura, prompted Pettitte to return to the majors. They view his talent as a gift from God, and don’t believe he should waste it.

When Pettitte faced the Nationals on Saturday, he became the first 40-year-old starter for the Yankees since Roger Clemens in 2007. His slider didn’t show his age, however, as it dazzled the Nats for seven innings. Pettitte needed just 13 pitches to retire 19-year-old Bryce Harper four straight times. Harper struck out on sliders in his first three at-bats.

“He’s prepared himself to do this. He works extremely hard,” Yankees Manager Joe Girardi said. “As I’ve said all along, I didn’t think he would do this if he couldn’t pitch at a high level.”

Pettitte said he doesn’t try to influence the other members of the Yankees’ staff. They’re professionals with great drive, he said. But their numbers have improved significantly since he returned.

Ivan Nova, 25, has won his last five starts. Phil Hughes and C.C. Sabathia, 31, have won three of their four June starts. Pettitte said he’s known Hughes, who turns 26 on Sunday, since Hughes was a rookie and hopes to be a positive influence on him.

“A guy that’s been out of the game for so long and comes back and pitches the way he has, it motivates the team,” veteran outfielder Andruw Jones said. “He boosted the young guys. Him going out there throwing a solid seven, eight innings, it makes everyone in the rotation want to be better.”

This offseason, Pettitte most likely will have another series of meetings with his family in Texas. If his slider continues to dart across the plate, chances are he’ll entertain playing another season. Or he may step away from the game again.

No matter the decision, it won’t be his alone. When baseball comes in third, it’s perhaps easier to rely on faith and family to make the choice with you.