If this is to be Cole Hamels’ swan song for the Phillies, he certainly went out in style.

Coming off consecutive brutal performances in which he allowed 14 earned runs in six and a third combined innings, the 31-year-old Hamels responded by throwing the 13th no-hitter in Phillies history in a 5-0 win Saturday.

Not only that, but he did to the Chicago Cubs, who hadn’t been no-hit since Sandy Koufax did it 50 years ago, a span stretching 7,920 games.

Striking out 13, while walking two, Hamels was in command from the start, after working out some mechanical flaws in his delivery. But there was an anxious moment at the end with two outs in the ninth when Cubs’ rookie Kris Bryant lined a 3-2 pitch to deep center. Centerfielder Odubel Herrera had trouble tracking the ball down, slipping on the warning track, before making a lunging catch to preserve the no-no.

“It’s being able to pound the zone, which is something I wanted to do today,’’ Hamels told Comcast Sportsnet immediately afterwards of the dramatic turnaround from his previous starts. ``Make them swing at bad pitches."

"Once you’re able to find it mechanically, everything clicks. Just go out there and let it happen. That’s what I’ve always been able to do. Unfortunately I wasn't able to do it the last couple of games.’’

The subject of constant trade rumors with the July 31 deadline approaching, Hamels has maintained a calm demeanor despite the uncertainty.

“It’s something where I have to go out there and enjoy the moment,’’ said Hamels, who pitched the first six innings of a combined no-hitter with three relievers last Labor Day in Atlanta.

“That’s kind of my focus. Enjoy what I’m able to do. Not a lot of people get to do what I do and sometimes you take it for granted."

“Obviously, this happened.’’

Hamels, who hadn’t won since May 28 in Washington and has frequently been the victim of poor run support throughout the last three seasons, got all the runs he needed on Ryan Howards’ three-run homer thirdi-inning homer off Jake Arrieta. The Phillies added two more in the eighth

Hamels took it from there and made history.