Alonso homered to left field in the ninth inning. The 418-foot blast off the Kansas City Royals' Jacob Barnes broke a tie with the Los Angeles Dodgers' Cody Bellinger for most home runs by a NL rookie in a season.
Bellinger hit 39 home runs in 2017.
"It's crazy," Alonso said after the Mets' 11-5 victory when asked about setting the record. "I just gotta go back to the days of spring training when I didn't know if I was gonna make the team out of camp or not. I'm just extremely thankful for this opportunity, and this has been such an incredible year. I just wanna keep building and help this team win."
Alonso quickly fell behind 0-2 in the count, but when Barnes threw a high fastball, he didn't miss.
"I was just trying to hit the ball hard like I have been,'' said Alonso, who is the first Mets player to hit 40 home runs in a season since Carlos Beltran hit 41 in 2006. "Take good, quality swings at good pitches and, thankfully, he gave me a fastball up in the zone, which I like to swing at.''
The result was a no-doubt shot over the bullpen in left field that snapped the tie with Bellinger, who hit the 39-home run mark on the way to winning Rookie of the Year honors in 2017.
"It was a pretty grand one,'' New York manager Mickey Callaway said. "It went a long way, it seemed like.''
Bellinger took to Twitter after Sunday's action to congratulate Alonso on breaking his record.
Congrats @Pete_Alonso20 on breaking the NL rookie HR record. u a beast 🔥🔥🔥🔥🔥🔥🙌🙌— CodyBellinger (@Cody_Bellinger) August 18, 2019
Next up for the 24-year-old Alonso is the Mets' season record of 41 home runs set by Todd Hundley in 1996 and equaled by Beltran a decade later.
"That's even more mind-boggling,'' Alonso said. "I'm just really grateful. Grateful and thankful and happy that I've had this opportunity.''
With the home run, Alonso improved to 3-for-4 in the Mets' victory over the Royals, with three runs and two RBIs.
The victory pulled the Mets (64-60) into a three-way tie in the NL wild-card chase, 1½ games behind the Chicago Cubs, who hold the second wild-card spot.
The Associated Press contributed to this report.