Conor Shaughnessy scored late to help Portsmouth win League One and promotion to the Championship with a 3-2 victory over Barnsley at Fratton Park.
Pompey knew one point would get them back into the second tier after a 12-year absence, but they were up against it after Devante Cole and John McAtee scored for the play-off-chasing Tykes, each side of Kusini Yengi’s equaliser.
However, the hosts prevailed thanks to Colby Bishop’s 83rd-minute penalty and Shaughnessy’s last-ditch effort.
Cole startled Pompey fans in the sixth minute by scoring his 18th goal of the season – but first in 15 games – from close range.
But Pompey equalized three minutes later when Yengi blasted home.
McAtee’s 14th goal of the campaign around the hour mark put Barnsley back in front and the Reds edged closer to a win that would have secured their play-off spot.
Despite Pompey’s late performance, they are still only four points ahead of seventh-place Lincoln with two games remaining.
Christian Saydee won the penalty, which Bishop converted before Shaughnessy headed home from a corner at the death.