Wayne Routledge and André Ayew shocked the hosts, who had started brightly, after scoring twice in six minutes to put the Swans ahead.

Sung-yeung Ki added a third after the break but a Stephen Kingsley own-goal gave West Ham hope.

But Bafetimbi Gomis put paid to his rotten form to seal a huge 4-1 win.

Hosts pile on the pressure

West Ham, driven on by a passionate home crowd in their final conventional kick-off at Upton Park, were coming forward from the first whistle. The Swans had Lukasz Fabianski for keeping them in it after a Dmitri Payet drive and Winston Reid header forced good saves from the Polish stopper inside five minutes.

The Hammers were happy to continue in their pursuit of an early opener, and Mark Noble was next to try his luck; his shot flew wildly over from the edge of the area, however. Swansea were unable to find any time on the ball with Slaven Bilic's high pressing approach, evidence of the intensity level the hosts were showing.

Modou Barrow and André Ayew almost shocked the hosts into silence shortly after, as the Welsh side carved out a chance of their own. The Gambian danced into the area before teeing up Ayew, only to see Aaron Cresswell make a key interceptions and turn the ball behind. Payet kept Swansea honest, though, with two free-kicks flying close.

Swansea strike twice in quick succession

Despite their dominance and the free-kicks of their French playmaker's giving Fabianski constant headaches, the visitors went ahead. Sung-yeung Ki drove into space and picked out a superb ball to Kyle Naughton at the back post. The defender fired a cross along the face of goal, and Wayne Routledge came in and gleefully tapped in.

Then came a crucial phase of play; while Angelo Ogbonna fired over from a loose ball in the box, Swansea were clinical at the other end. This time it was the other full-back, Stephen Kingsley, who provided the assist with a sensational cross into the six-yard area. Ayew, similar to Routledge, slid the ball into a open net; 2-0 in the blink of an eye.

West Ham regrouped and launched a late onslaught on the Swansea goal, with Payet, Manuel Lanzini and Andy Carroll all going close just before the break. But, to their credit, Francesco Guidolin's men held on to their two-goal cushion.

Ki capped off a fine individual performance with a great goal of his own. | Image source: Swansea City

Both sides trade second-half strikes

There were no changes from either side after the break and both teams continued to come forward at will. It was an even opening, but Swansea's remarkable finishing seen them score a third. Another move out wide proved to be West Ham's undoing as Barrow burst down the left and crossed for Ki, who sent a superb first-time volley into the far corner; the travelling support could hardly believe their eyes.

West Ham returned, once more, with pressure in abundance and Michail Antonio was brilliantly denied by Fabianski at point blank range; Carroll fired the rebound wide from 20 yards, as the seemed resigned to shooting from distance rather than making the most of his aerial abilities.

Then the game turned with the introduction of Diafra Sakho for Victor Moses. The attacker gave Kingsley massive problems after coming on, and forced the young left-back into putting through his own net. Cheikhou Kouyaté and Sakho were both thwarted by Fabianski but, in his attempts to clear, Kingsley thundered into his own net.

Despite the best efforts of both sides to find a fifth goal, it wasn't forthcoming until stoppage time. Gomis, the forgotten man at the club, took full advantage of an Ayew cut-back to end his goalscoring drought and Swansea had put an end to West Ham's unbeaten streak. They moved into 11th, and have put West Ham's chances of taking a top six place in doubt as a result.