Lincoln kept alive their hopes of automatic promotion as they extended their unbeaten run to seven games.
The Red Imps struggled to get the break through and in the end had to rely on an 82nd minute winner from substitute Simon Yeo.
Yeo's goal gave his team their first back to back league victories since October and keeps the pressure on third place Huddersfield.
But for the first 45 minutes the Imps looked as if they were going to fail to take advantage of their almost constant bombardment of the Swansea goal.
Swans keeper Roger Freestone fought off a number of excellent saves to keep the scores level before the Welsh club went in front with their first effort on target.
Midfielder Roberto Martinez sent a 43rd minute free kick into the box which was flicked on by Kristian O'Leary for Matthew Rees to mark his debut with a goal.
Lincoln levelled things up in the 57th minute when Gary Fletcher and Marcus Richardson combined to set up Peter Gain for his 6th goal of the season.
But six minutes later Swansea should have been back in front when top scorer Lee Trundle found himself unmarked 10 yards from goal only for his powerful shot to be well saved by Alan Marriott.
Yeo's winner brought complaints from Swansea that he was offside when he stole through to head over the exposed Freestone.
Swansea's new boss Kenny Jackett in charge of the club in a league game for the first time, said: "The linesman, in my opinion, made a mistake. It was a clear yard off side. I felt we deserved something out of the game. We had five chances in the second half and had we taken any of them we would have gone on to win.
"But I was delighted with the team spirit and the way the players battled." Lincoln manager Keith Alexander said: "In the first half we were the better team by a million miles but we went in a goal down. Swansea scored with the first effort they had on goal.
But we sorted it out at half time and the players showed a lot more patience in the second half. We deserved to win."