How do you turn a foul ball into a home run? If you're comedian Chris Rock, you do it with a little luck, and a spur-of-the-moment generous gift, all on live television.

Yes, that was Rock (and Emmy-winning "Boardwalk Empire" star Bobby Cannavale) sitting in the stands at Thursday's Yankees-Astros game at Yankee Stadium. And in the top of the seventh inning when Astro first baseman Jon Singleton popped a foul ball their way, it was Rock who came up with the ball, much to the delight of the crowd.

But as the fans cheered for the comedian, he spotted a young boy a few seats over, and decided the kid would get a bigger thrill out of the souvenir than he would. Rock reached out and gave the ball away.

Trending stories,celebrity news and all the best of TODAY. This site is protected by recaptcha

'Boy, he could run for office," said Yankees play-by-play man Michael Kay as the crowd cheered Rock's gesture.

Rock didn't actually catch the ball, but it fell into his seat, "so he gets credit," Kay said.

Sports website Deadspin endorsed the comedian's careful, yet successful process. "Rock's method of getting the ball — half-heartedly putting one hand up while being more concerned about your own safety — is the way to go," wrote Samer Kalaf.

Rock also posted an Instagram photo of himself and Cannavale at the game, and fans used the comments section to congratulate him on the kind act.

"Was this taken before or after you gave that kid your foul ball, @chrisrock? That almost made me feel feelings, man," wrote one.

Rock and Cannavale starred together on Broadway in the 2011 play, "The Mother(expletive) With the Hat."

Follow Gael Fashingbauer Cooper on Google+.