Newport 2-1 Notts
A late Mark O'Brien strike consigned Notts County to defeat on the final day of the 2016-17 campaign.
Newport, needing a win to guarantee safety, took the lead through Mickey Demitriou's penalty before Jorge Grant's second-half leveller left the hosts needing a dramatic winner.
And that's exactly what they got from O'Brien in the 90th minute, the defender lashing the ball home to provoke jubilant scenes at Rodney Parade.
Kevin Nolan made one change to the side that faced Blackpool last weekend, handing 17-year-old Alex Howes his senior debut on the left wing. Mark Yeates was the man to make way.
Another young winger, Sam Osborne, was named among the Magpies' substitutes, while Grant and Josh Clackstone were given starts in their final matches on loan from Forest and Hull respectively.
Notts claimed the first shot of the afternoon, Jon Stead collecting a pass from Clackstone before curling the ball wide from 25 yards.
Understandably, however, Newport were playing with fire in their bellies and, shortly after Carl Dickinson had made an excellent challenge to halt Mark Randall's progress, Howes made a superb last-ditch interception to deny Tom Owen-Evans an almost certain goal at the back post.
Notts Player of the Season Rob Milsom had a glimpse at goal minutes later, receiving a cut-back from Shola Ameobi on the edge of the area before miscuing his first-time strike on the bobbly surface.
It was the same story for Owen-Evans at the other end on 25 minutes after he tricked his way into the area and spooned the ball high over the bar.
But Newport were given the golden opportunity they so desperately wanted when Haydn Hollis was adjudged to have felled Lenell John-Lewis in the penalty area. Demetriou stroked the ball to Adam Collin's right to give his side the lead.
There were no changes at the break and Notts had a half-chance to equalise shortly after the restart, winning a free-kick within shooting range. Grant took charge but could only curl the ball a yard over the bar.
John-Lewis sent an acrobatic effort over the bar shortly before Alan Smith and Marc Bola replaced Howes and Carl Dickinson. The switch saw Milsom move out to the left, with Smith taking his place alongside Elliott Hewitt in central midfield.
Ryan Bird whistled a long-range effort over the bar as the hosts looked to double their advantage.
But they in fact lost their lead moments later when Grant was first to capitalise on a loose ball in the area, turning the ball beyond Joe Day in the Newport goal.
The ascendancy was now with Notts and, after Hewitt had fired wide from range, Grant's powerful effort was palmed away by Day.
John-Lewis led the Newport breakaway but his effort was way off-target, Hollis applying pressure as the forward wound up to shoot.
Jon Stead saw a looping header nodded off the line by a Newport defender as nerves began to jangle at Rodney Parade.
And, seconds after Stead burst through midfield before skewing the ball wide, news came through from Hartlepool that they were now beating Doncaster, leaving Newport in the bottom two with less than 10 minutes to play.
But the hosts were not to worry as, seconds before five minutes of added time were indicated, the ball fell for O'Brien in the area and the defender finished with aplomb to spark scenes of wild celebration among the home supporters.
Clackstone sent a shot over as Notts sought an injury-time equaliser but it wasn't to come as Newport secured their League Two status on a dramatic day in south Wales.