Grant McCann's stunning free-kick lifted Peterborough out of the relegation zone and stopped Sheffield Wednesday from securing their safety.
Dwight Gayle forced a save from Owls keeper Chris Kirkland before Anthony Gardner headed wide for Wednesday.
McCann struck a long-range free-kick after the break that found the net via the post to hand the hosts the victory.
- Peterborough are undefeated in six games at London Road having won three and drawn three
- They have lost just once in their last 12 outings home and away
Darren Ferguson's side are now out of the bottom three on goal difference while the Owls sit a point clear.
Peterborough go back ahead of Barnsley, who beat Hull earlier on Saturday, on goal difference in the table heading into their final game of the season at Crystal Palace.
Wednesday now have to beat Middlesbrough at home on the final day to ensure they remain in the second tier.
A point would have been enough to secure Wednesday's Championship status and they came close to taking the lead when a high free-kick dropped to Seyi Olofinjana but a brave block from Gabriel Zakuani denied the Owls.
Gayle then had a chance to get his 14th goal for Posh but his low effort was easily saved by Wednesday keeper Kirkland.
As the break approached, Dave Jones's side thought they had the lead when Gardner met Danny Pugh's corner but his header was just wide.
After half-time, Gayle was lively again but this time Miguel Llera blocked his shot inside the area and referee Nigel Miller waved away pleas for handball.
The opener came just after the hour mark when McCann stepped up to fire in a powerful free-kick off the post.
Leroy Lita, Lewis Buxton and Gardner all missed late chances for the Owls but Peterborough held on and their survival hopes remain in their own hands.
Peterborough manager Darren Ferguson:
"Great players always perform in the big games and Grant does that for us.
"We've done our job this weekend but we have another big one to do next weekend. I've felt for a while that it would go all the way to the final day of the season and that's how it has panned out.
"We're in a good position in so much as we know that if we match Barnsley's result, we'll stay up. I've got a fantastic bunch of lads and have never once questioned their commitment. Yes, they make the odd mistake, but they are only human."
Sheffield Wednesday manager Dave Jones:
"There were a lot of nervous people out there on the pitch and it was always going to take something special to win the game.
"We didn't do any better or worse than Peterborough did, but they had that one moment that mattered. It was sloppy on our part to concede the free-kick.
"There are several teams still in danger but our destiny is in our own hands and that is what is important. We're not in the position of having to rely on other results.
"Staying in this league will be a far bigger achievement than winning promotion last season to get here."
- 01 Olejnik
- 03 Alcock
- 05 Zakuani
- 06 Bostwick
- 11 McCann (Ferdinand - 84' )
- 14 Rowe
- 26 Payne
- 33 Pritchard (Barnett - 83' )
- 44 Mendez-Laing (Newell - 81' )
- 08 Tomlin
- 34 Gayle
- 13 Day
- 04 Brisley
- 17 Newell
- 18 Ferdinand
- 20 Knight-Percival
- 09 Barnett
- 37 McDonald
- 01 Kirkland
- 02 Buxton
- 04 Gardner Booked
- 32 Llera Booked
- 15 Helan (Lita - 67' )
- 16 McCabe (Lee - 46' )
- 19 Pugh
- 23 Olofinjana
- 28 Coke Booked
- 10 Maguire
- 29 Howard (Madine - 73' )
- 43 Bywater
- 05 Taylor
- 14 Mattock
- 06 Semedo
- 20 Lee
- 09 Madine
- 24 Lita
Live Text Commentary
Full Time The final whistle is blown by the referee.90:00 +3:43
Tyrone Barnett takes a shot. Comfortable save by Chris Kirkland.90:00 +2:03
Lee Tomlin fouled by Chris Maguire, the ref awards a free kick. Robert Olejnik restarts play with the free kick.90:00 +0:40
Free kick awarded for an unfair challenge on Seyi Olofinjana by Dwight Gayle. Chris Kirkland restarts play with the free kick.89:22
A cross is delivered by Lewis Buxton. Outswinging corner taken right-footed by Danny Pugh.87:20
Free kick awarded for an unfair challenge on Dwight Gayle by Chris Kirkland. The ball is sent over by Lee Tomlin, Headed effort from inside the box by Tyrone Barnett misses to the right of the target.86:19
The ball is crossed by Lewis Buxton.84:53
Centre by Joe Newell, blocked by Lewis Buxton.83:13 Substitution
Substitution Kane Ferdinand joins the action as a substitute, replacing Grant McCann.81:53 Substitution
Substitution (Peterborough) makes a substitution, with Tyrone Barnett coming on for Alex Pritchard.81:53
Leroy Lita takes a shot. Save by Robert Olejnik. Effort from deep inside the area by Leroy Lita misses to the left of the goal.80:57 Substitution
Substitution Joe Newell is brought on as a substitute for Nathaniel Mendez-Laing.80:17
Lee Tomlin produces a right-footed shot from the edge of the box and misses to the right of the goal.75:46
Inswinging corner taken by Chris Maguire, Headed effort from inside the area by Miguel Llera misses to the left of the goal.74:14
Centre by Danny Pugh, save by Robert Olejnik.72:35 Substitution
Substitution Gary Madine comes on in place of Steve Howard.71:37
Direct free kick taken by Grant McCann.71:37 Booking
Booking Giles Coke goes into the book for unsporting behaviour.71:30
Giles Coke concedes a free kick for a foul on Alex Pritchard.68:34
The offside flag is raised against Leroy Lita. Robert Olejnik takes the free kick.
Lee Tomlin takes a shot. Save made by Chris Kirkland. Inswinging corner taken by Alex Pritchard.66:18 Substitution
Substitution Leroy Lita comes on in place of Jeremy Helan.65:49
Centre by Nathaniel Mendez-Laing.64:57
Chris Maguire has shot on goal from just outside the penalty box which goes wide of the right-hand upright.64:39
Lewis Buxton delivers the ball.63:18
Alex Pritchard provided the assist for the goal.63:18 Goal scored
Goal! - Grant McCann - Peterboro 1 - 0 Sheff Wed Free kick scored by Grant McCann from outside the penalty area to the top left corner of the goal. Peterborough 1-0 Sheff Wed.61:44 Booking
Booking Anthony Gardner is shown a yellow card.61:39
Free kick awarded for an unfair challenge on Alex Pritchard by Anthony Gardner.60:08
The referee blows for offside against Steve Howard. Free kick taken by Robert Olejnik.58:44
Grant McCann restarts play with the free kick.58:44 Booking
Booking Miguel Llera booked.58:35
Lee Tomlin fouled by Miguel Llera, the ref awards a free kick.56:31
Dwight Gayle has an effort at goal from deep inside the area missing to the left of the target.55:42
Steve Howard takes a shot. Save by Robert Olejnik.54:47
Free kick awarded for a foul by Alex Pritchard on Lewis Buxton. Free kick crossed by Danny Pugh, Grant McCann makes a clearance.51:53
Chris Maguire takes a shot. Blocked by Gabriel Zakuani.49:07
Dwight Gayle takes a shot. Miguel Llera gets a block in.47:56
Shot on goal by Jack Payne from just inside the area clears the crossbar.46:52
Lewis Buxton sends in a cross, Gabriel Zakuani manages to make a clearance. Corner taken by Danny Pugh played to the near post, Grant McCann makes a clearance.46:32
The ball is swung over by Danny Pugh.45:45
Foul by Michael Bostwick on Chris Maguire, free kick awarded. Free kick taken by Chris Kirkland.45:01
The referee starts the second half.45:01 Substitution
Substitution Kieran Lee replaces Rhys McCabe.45:00 +1:04 Half time
Half Time The half-time whistle blows.42:39
Inswinging corner taken right-footed by Danny Pugh from the right by-line, Anthony Gardner has a headed effort at goal from deep inside the area missing to the right of the goal.42:07
Dwight Gayle takes a shot. Fantastic save by Chris Kirkland.39:56
Foul by Chris Maguire on Jack Payne, free kick awarded. Craig Alcock restarts play with the free kick.38:54
Free kick awarded for an unfair challenge on Alex Pritchard by Seyi Olofinjana. Michael Bostwick takes the free kick.38:05
Free kick awarded for a foul by Danny Pugh on Nathaniel Mendez-Laing. Michael Bostwick takes the direct free kick.37:21
Lee Tomlin produces a cross, clearance made by Miguel Llera.37:01
Nathaniel Mendez-Laing delivers the ball, Anthony Gardner manages to make a clearance.34:42
Free kick awarded for a foul by Steve Howard on Gabriel Zakuani. Free kick taken by Jack Payne.34:11
Free kick awarded for a foul by Jack Payne on Chris Maguire. Chris Kirkland takes the free kick.31:21
Alex Pritchard delivers the ball, Lewis Buxton gets a block in. Outswinging corner taken right-footed by Alex Pritchard from the left by-line, save by Chris Kirkland.30:25
The assistant referee flags for offside against Jeremy Helan. Robert Olejnik takes the free kick.29:53
Free kick awarded for a foul by Jack Payne on Chris Maguire. Direct free kick taken by Lewis Buxton.28:43
Inswinging corner taken by Danny Pugh from the right by-line, clearance made by Grant McCann. Danny Pugh produces a cross, save by Robert Olejnik. Chris Maguire produces a right-footed shot from the edge of the box and misses to the right of the goal. Alex Pritchard fouled by Lewis Buxton, the ref awards a free kick. Tommy Rowe takes the free kick.26:31
Rhys McCabe takes a shot. Lee Tomlin gets a block in. Giles Coke takes a shot. Robert Olejnik makes a save. Inswinging corner taken left-footed by Danny Pugh, Grant McCann makes a clearance. Corner taken by Chris Maguire from the left by-line. Foul by Nathaniel Mendez-Laing on Danny Pugh, free kick awarded. Chris Maguire takes the free kick. Seyi Olofinjana takes a shot. Gabriel Zakuani gets a block in.26:09
Michael Bostwick gives away a free kick for an unfair challenge on Steve Howard. Free kick taken by Lewis Buxton.22:42
Free kick awarded for an unfair challenge on Grant McCann by Giles Coke. Lee Tomlin takes the direct free kick. Shot by Michael Bostwick from outside the box goes high over the crossbar.20:48
Nathaniel Mendez-Laing delivers the ball, clearance by Danny Pugh. Alex Pritchard takes the outswinging corner, clearance made by Rhys McCabe. Corner taken by Grant McCann played to the near post, clearance by Giles Coke.20:32
Rhys McCabe produces a cross, Robert Olejnik makes a save.19:13
The assistant referee signals for offside against Steve Howard. Michael Bostwick takes the free kick.14:07
Inswinging corner taken by Alex Pritchard from the left by-line, Headed effort from deep inside the penalty area by Tommy Rowe misses to the right of the target.13:16
Corner taken right-footed by Chris Maguire to the near post, Gabriel Zakuani makes a clearance.12:36
Lewis Buxton fouled by Dwight Gayle, the ref awards a free kick. Direct free kick taken by Chris Kirkland.11:05
Alex Pritchard fouled by Miguel Llera, the ref awards a free kick. Grant McCann takes the free kick.9:24
Lee Tomlin takes a shot. Save made by Chris Kirkland. Grant McCann takes the inswinging corner, clearance by Giles Coke.8:00
The referee blows for offside. Robert Olejnik takes the free kick.7:20
Unfair challenge on Giles Coke by Alex Pritchard results in a free kick. Lewis Buxton takes the direct free kick.2:27
Dwight Gayle is caught offside. Chris Kirkland takes the indirect free kick.0:41
Header on goal by Steve Howard from just inside the area goes over the target.0:07
Free kick awarded for a foul by Gabriel Zakuani on Giles Coke. Chris Maguire takes the direct free kick.0:00
The ref blows the whistle to start the match.
Live data and text provided by our data suppliers