Rotherham ended their six-season stay in npower League Two and condemned Aldershot to non-league football next season with their 2-0 win at New York Stadium.
Johnny Mullins broke the deadlock from close range in the 64th minute before Lee Frecklington scored Rotherham's second in injury time to seal promotion to the third tier.
Defeat for Aldershot meant they were unable to bridge the gap to safety and drop out of the Football League along with Barnet, who were beaten 2-0 by Northampton.
Goals by Roy O'Donovan and Luke Guttridge for the Cobblers doomed Barnet, who were relegated thanks to their poorer goal difference than Dagenham and Redbridge, who also finished the season with 51 points.
York, who had for some time to be staring into the abyss, ended their campaign on a high with a 1-0 away win over Dagenham and Redbridge, Chris Smith scoring the only goal.
AFC Wimbledon, who had been in the drop zone at the start of the day, escaped following their 2-1 win over Fleetwood.
Gary Alexander put Wimbledon ahead in the 61st minute but the lead was soon cancelled out by Andy Mangan.
Rob Atkinson's foul on Curtis Osano gave Wimbledon a lifeline, with Jack Midson converting from the penalty spot to seal his side's League Two future.
Torquay were another side in danger of relegation but Aldershot and Barnet's defeats and their 3-3 draw against Bristol Rovers saw them to safety.
Elliot Benyon scored either side of Ryan Jarvis' goal after Rovers had been 2-0 up thanks to Tom Hitchcock's 31st-minute strike and Jarvis' own goal.
Torquay looked set to win but Matt Harrold denied them with a stoppage-time header.
Elsewhere, Cheltenham drew 0-0 against 10-man Bradford, who lost Andrew Davies midway through the second half, while Lee Hughes' goal for Port Vale cancelled out Dean Morgan's penalty for Wycombe as they drew 1-1 to their automatic promotion.
Chesterfield finished just outside of the play-off places despite their 4-0 win over Exeter.
Goals by James O'Shea and Marc Richards, plus a brace for Jack Lester in the final game of his career saw Chesterfield finish on a high and end up two points adrift of Bradford in the last play-off place.
Play-off-bound Burton beat champions Gillingham 3-2 at the Pirelli Stadium.
Myles Weston opened the scoring for the Gills from the penalty spot after Aaron Webster brought down Bradley Dack before Billy Kee and Michael Symes put Burton ahead.
Calvin Zola then made it 3-1 to the home side before Nathan Nyafli pulled one back for Gillingham.
Morecambe beat Southend 1-0 thanks to Andrew Fleming's first-half goal and Rochdale beat 10-man Plymouth 1-0, with Joe Bunney's header midway through the second half the difference after Maxime Blanchard saw red in the 15th minute.
Oxford beat Accrington 3-0 with Accrington midfielder Lee Molyneux shown a red card one minute before the final whistle. James Constable, Deane Smalley (penalty) and Sean Rigg scored the goals for Oxford.