Liverpool had not lost a Premier League match on home turf in 12 months, but Fernando Llorente's double left the Reds facing an uphill task.
Roberto Firmino scored twice himself to level the scores and it appeared as though the momentum was with the home side until Gylfi Sigurdsson's goal on the counter-attack in the 74th minute earned Swansea a crucial three points that moves them off the bottom of the table.
And head coach Paul Clement was delighted with the way Swansea stuck to the shape he had set out in training this week to stifle Liverpool's dangerous attack.
"I'm obviously very pleased not just with the result but the performance, we defended very well in the first half," he told BBC Radio 5 Live.
"Our shape was good, we frustrated Liverpool and made it difficult for them to get through us, we had a couple of balls out wide into our box which we ended up dealing with as well.
"We had a very good start to the second half with the set play but yeah, it was a really good second half.
"I was disappointed to concede two quickly and there was a lot of time left, it would have been easy for the team to capitulate at that point but we went on, got another goal and saw the game out.
"It will give everyone a big boost, this victory."
Clement admitted he feared the worst when Liverpool brought the match back to 2-2.
He added: "The crowd really erupted at that moment and the momentum was with Liverpool, but football is a strange game and we got that counter-attack against the run of play.
"We had to soak up a lot of pressure this afternoon but we knew that was going to be the case and that's what we worked at in training in the week and I think we deserved to win, even for just how we defended and from a character point of view."
Asked what the win will do for Swansea's battle against relegation, Clement said: "It's very good for the confidence and for me as a coach it reinforces the hard work we've done on the training ground, we had a really good week of training."