But the win came at a cost with influential midfielders Darren Pratley and Ferrie Bodde both being forced off injured in the first half at the Liberty Stadium.
Pratley was replaced by Mark Gower after just 23 minutes before Bodde, who was making his first start since September following a serious knee injury, left the field soon after.
Posh went into the game without key trio George Boyd, Craig Mackail-Smith and Aaron Mclean, who were all ruled out through illness. That meant Boyd's consecutive appearance record of 144 games was put to an end, while goalkeeper Joe Lewis took over the captaincy in the striker's absence.
Despite a bright start from the visitors, it was Swansea who produced the first chance of the game when Shefki Kuqi's right-footed effort was parried by Lewis after just four minutes.
But Paulo Sousa's men made no mistake after 19 minutes when Charlie Lee carelessly gifted possession to the hosts before later bundling over Cotterill in the box.
Wales international Cotterill stepped up to place the resulting spot-kick into the bottom right-hand corner of the net for his third goal in five games.
Swansea were dealt a blow just four minutes later when Pratley left the field for treatment before being withdrawn as a precaution.
The injuries were piling up for Sousa as Bodde went down near the touchline unchallenged after 28 minutes. The Swans played with 10 men for a few minutes before Lee Trundle, who scored both goals when the Swans claimed a 2-2 draw at London Road in December, came on to replace the Dutchman.
At the other end, Lee tried to atone for his earlier error before half-time but his long-range strike sailed harmlessly over the bar.
Posh were almost made to pay for their lack of cutting edge in the final third when Exodus Geohaghon gifted the ball straight to Kuqi, but the striker was denied by the feet of Lewis before the former Kettering defender redeemed himself to clear Nathan Dyer's rebound off the line.
Peterborough boss Jim Gannon gave Nathan Koranteng a chance to impress in the second half as the youth team striker replaced Lee.
And Posh had a chance to level matters within three minutes of the restart but Tommy Rowe's header drifted wide of a post.
But for all their hard work Gannon's men, who lost Scott Griffiths with what appeared to be a back injury after 53 minutes, could not find an equaliser as Lee Frecklington headed wide from Koranteng's cross.
Lewis produced a string of fine saves to keep Trundle, Kuqi and Dyer at bay, while Liam Dickinson's volley deflected over the bar at the other end as Swansea held on.