MANCHESTER, N.H. — Travis Shaw hit a three-run homer in the 12th inning Tuesday night to rally the Portland Sea Dogs to a 9-3 victory over the New Hampshire Fisher Cats at Northeast Delta Dental Stadium.

Despite the victory, Portland’s postseason hopes came to an end when second-place Reading defeated Binghamton 12-8, leaving the fourth-place Sea Dogs 6 1/2 games behind the Phillies with six games remaining. The top two teams in each division advance to the playoffs.

Portland loaded the bases with no outs in the 12th on a single, a walk and a fielding error. Derrik Gibson followed with a two-run single, then Shaw hit his blast before Shannon Wilkerson added a two-out RBI single.

Before the rally, no runs were scored after the third inning. The Sea Dogs scored single runs in each of the first three, and the Fisher Cats had one in the first and two in the second.

The Sea Dogs scored when Peter Hissey led off the game with a single, moved to second on a groundout, stole third and scored on another groundout.

The Fisher Cats tied it in their half of the first on an RBI double by Ryan Schimpf.

In the second, Hissey drove in Christian Vazquez with a sacrifice fly before New Hampshire led 3-2 on a triple by Jake Marisnick and single by Ryan Goins.

Portland got its third run when Bryce Brentz reached on an error, moved to third on a double by Shaw and scored on a sacrifice fly by Xander Bogaerts.

Starter Allen Webster lasted four innings, then Mike MacDonald (3-2) pitched the next seven, allowing two hits and two walks, striking out six. He retired 12 straight from the seventh into the 11th.