David Ortiz made a surprise appearance at Fenway Park on Monday night to throw out the ceremonial first pitch before the Boston Red Sox played their final game of the season against the rival New York Yankees.

Ortiz's cameo marked the first public appearance for the former Red Sox slugger since he was wounded in a shooting in the Dominican Republic in June. The three-time World Series champ required multiple surgeries and had his gallbladder and part of his intestine removed.

WASHINGTON NATIONALS PITCHER GETS EMOTIONAL AFTER MAKING FIRST APPEARANCE SINCE 2015

Walking to the mound before the game, Ortiz thanked fans for their thoughts and prayers and threw the pitch to Jason Varitek, who won two World Series while serving as Boston’s catcher from 1997 to 2011 and currently works as a special assistant in the Red Sox front office.

“I want to thank all of you for all the prayers,” Ortiz said. “I really appreciate it. Thank you very much. I want to thank my former teammates for being there for me. So, a lot of them came home to check up on my boy. Also, I want to thank the Yankees, a lot of my boys over there and checked up on Big Papi. Thank you very much, appreciate it. CC [Sabathia], [Edwin] Encarnación. Thank you very much. God bless you all. Go Sox.”

Ortiz was shot in the back by a hired gunman who drove up on a motorcycle and fired at close range, hitting him in the torso, police said. Ortiz wasn’t the intended target, according to authorities.

CLICK HERE TO GET THE FOX NEWS APP

Ortiz, who bashed 541 home runs during a 20-year career with the Minnesota Twins and Red Sox, played with Boston from 2003 to 2016. A key player on the Red Sox 2004 World Series squad, he helped the team win its first championship in 86 years, breaking “The Curse of the Bambino." His prolific bat also contributed to World Series wins in 2007 and 2013.

The Associated Press contributed to this report.