MIAMI — With the bases loaded, two outs and the score 0-0 in the bottom of the ninth, Henderson Alvarez stood in the Miami Marlins’ on-deck circle, bat in hand, hoping to complete his no-hitter.

Alvarez (5-6) blanked the Detroit Tigers for nine innings — and briefly, mistakenly thought he had pitched a no-hitter. But the Marlins needed a run for him to achieve the feat.

“I was nervous and anxious,” he said through a translator. “I started praying, ‘Please give us a run.’ I was hoping for a wild pitch.”

That’s exactly how Miami scored. Giancarlo Stanton crossed the plate standing up when a breaking ball skipped to the backstop, and Alvarez had his no-hitter, beating the Tigers on the final day of the regular season Sunday, 1-0.

Save 75% on a Digital Subscription Today

Of the 282 no-hitters in history, it was the only one to end on a wild pitch. And it was the first walkoff complete-game no-hitter since Virgil Trucks of the Tigers threw one on May 15, 1952, against Washington.

Alvarez needed the run for his no-hitter to be official because a Major League Baseball ruling in 1991 said only complete games of nine or more innings with no hits count as no-hitters.