Swansea manager Kenny Jackett can breathe a little easier after Lee Trundle made a dramatic return to first-team action to set up a vital victory at Chesterfield.
Jackett left out top scorer Leon Knight and recalled Trundle who had recovered from the hamstring injury which had kept him out since early September.
The Swans boss later admitted it was a brave decision and Trundle repaid him with two goals and a clever assist to set up Leon Britton.
Jackett later denied that Knight had been dropped from the 16-man squad for disciplinary reasons but with Trundle on the score-sheet this will take some of the pressure off the manager's shoulders.
But it was still touch and go for Swansea who defended poorly at times and almost allowed Chesterfield to snatch a point.
The game should have been over by half-time but awful defending allowed Paul Hall to get a goal back and there were some anxious moments in the closing stages after a mistake by keeper Willy Gueret led to the home side's second.
It all looked so comfortable in the first half after Trundle's clever footwork and precise chip saw Britton volley his first goal of the season from eight yards.
Trundle's first goal was less spectacular, a close-range shot after Darren Way had flicked on Tom Williams' corner.
But there were signs of defensive frailty and a series of blunders allowed Hall to put the match back in the melting pot with a shot from 20 yards two minutes after the interval.
Swansea were now hanging on and were fortunate when Hall drove another shot from just outside the area against a post.
Andy Robinson and Darren Pratley wasted chances to ease Swansea's nerves but Trundle tucked away a 67th minute spot-kick after Britton had been tripped by Reuben Hazell.
Hazell put his team back in the game with a 77th minute header after Gueret had missed a corner and substitute Adam Smith was only inches away from equalising with a fierce long-range drive in stoppage time.