There are always twists and turns towards the end of a season but Swansea City could not have imagined the chain of events that has taken them out of the relegation zone with two matches remaining. Hull City’s surprise defeat at home against Sunderland opened a window of opportunity that Swansea took full advantage of with the most precious of victories, courtesy of yet another Fernando Llorente header.

It was Llorente’s 13th goal of the season and enough to lift Swansea one point ahead of Hull, who have now slipped into the bottom three, prompting huge celebrations among the home supporters here at the final whistle. With Hull travelling to Crystal Palace next Sunday, Swansea now have a chance to crank up the pressure on both of those clubs by picking up another three points at Sunderland the day before.

The most positive thought for Paul Clement and his players right now is that they are in control of their own destiny – a scenario that seemed unthinkable at the start of the day, with many people wondering how Swansea would respond when Hull opened up a five-point gap by beating already-relegated Sunderland.

The news that Hull had lost was greeted with jubilation by the home supporters beforehand and fuelled the raucous atmosphere inside the Liberty Stadium, helping to carry Swansea to victory. It was tense for long periods but especially in the closing stages, when Clement admitted his mind drifted back to that chastening defeat against Tottenham Hotspur, when Swansea conceded three late goals. On this occasion, however, his players refused to buckle.

Alfie Mawson was outstanding in central defence alongside the excellent Federico Fernández. The evergreen Leon Britton produced another influential performance at the base of the Swansea midfield and Jordan Ayew never stopped running up front. Yet it was Llorente who produced the game’s defining moment with his seventh headed goal of the season – more than any other Premier League player.

Ronald Koeman was left to rue that passage of play on another disappointing away day for Everton. They have failed to win in any of their last seven matches on the road and the lack of conviction in their attacking play must be a source of concern for the Everton manager.

Everton have failed to score in their last three matches and registered only five attempts on goal during that run. In fact it is hard to escape the feeling that, with little to play for between now and the end of the season, his players’ minds have already drifted to the summer.

“We know what we need to improve,” said Koeman. “Most of the things in the team are really good, [such as] the defending and organisation, but the difference between scoring goals at home and away from home is too big.”

Koeman tried to change things against Swansea by starting with Ross Barkley on the bench but Everton looked flat in the first half. Barkley was introduced at the restart and, although Everton had much more possession in the second half, the visitors created little of note.

Swansea actually looked more likely to score again. Ayew struck the outside of the post with a volley, Mawson’s header was blocked by Barkley – the Everton midfielder knew little about it – and Leroy Fer was desperately unlucky not to score when he met Tom Carroll’s fine cross with a first-time shot that Maarten Stekelenburg saved at point-blank range.

Llorente had not been so forgiving in the 29th minute. Ayew was the architect, the forward twisting and turning close to the byline to get away from Gareth Barry before delivering an inch-perfect cross that implored Llorente to nod home. Towering above Phil Jagielka, the Spaniard squeezed his header past Maarten Stekelenburg and the stadium erupted.

Belief coursed through Swansea for a period as they began to attack with more purpose. Everton looked a little disjointed and Swansea should have added a second four minutes later. Gylfi Sigurdsson, who had a penalty appeal turned down moments before Llorente’s breakthrough goal, delivered a cross from wide on the right that evaded a clutch of players and ran through to Mawson, on the edge of the six-yard box. Mawson seemed certain to score but Mason Holgate, Everton’s right-back, got across to make a superb block.

It was Swansea’s turn to throw bodies in front of the ball in the second half, prompting Clement to praise his players for a “magnificent collective effort defensively to get the right result”. With more of the same in the last two matches Swansea will be safe.