Crewe Alexandra secured their League One status with victory over Preston - their first home win since February.
The hosts went ahead on 10 minutes, Adam Dugdale heading his first goal of the season from a Jon Guthrie corner.
Preston were the brighter side after the interval but Mathias Pogba doubled Crewe's lead when he slotted home after Uche Ikpeazu's counter-attack.
John Welsh's shot into the bottom corner pulled one back for the visitors in the 90th minute but Crewe held on.
Preston's defeat cost them home advantage in the second leg of the League One play-offs.
Simon Grayson's side will now face fourth-placed Rotherham United at Deepdale on Saturday 10 May (17:15 BST).
The return is at the New York Stadium the following Thursday night (15 May, 19:45 BST).
Crewe Alexandra manager Steve Davis told BBC Radio Stoke:
"The other teams have lost as well but I wanted the players to do it themselves - and they have. The application of the players was excellent all week and we stuck to the game plan.
"I've told the players all season how important set plays can be in tight games. It is the second time we did that routine for the first goal and it paid off again. We did it at Shrewsbury when Mathias Pogba scored and it worked again with Adam Dugdale. We have a 100% record with that one!
"That gave us the one-goal cushion and I was pleased that we then restricted them to shots from distance. They never really got in behind us. The second goal was well worked and I thought we deserved it. Uche showed his strength and Pogs was in the right place to put it in.
"The supporters were magnificent and the atmosphere made it a great day for everyone. They really got behind the players and helped us get over the line. We have worked to be in this league and the fans played a massive part in keeping us there."