Joe Ralls' penalty miss proved costly for Cardiff City as Lucas Perez scored twice to help West Ham to a 3-1 Premier League win at London Stadium. 

Having replaced the injured Marko Arnautovic late in the first half, Perez followed up his first Premier League goal since January 2017 with a second just five minutes later to put the game beyond Cardiff. 

Things would have been different, however, had Ralls converted from 12 yards in the 35th minute, with Lukasz Fabianski pulling off a comfortable save from the midfielder's tame strike. 

And although the loss of Arnautovic seemed to have derailed West Ham's chances, replacement Perez took centre stage before Michail Antonio wrapped up the points just after the hour, meaning Josh Murphy's late header was no more than a consolation for the visitors. 

West Ham's dominant start looked set to be rewarded when Arnautovic burst beyond Cardiff's defence and hammered a low strike past Neil Etheridge, only for Sean Morrison to make a crucial block. 

Arnautovic was involved at the other end 10 minutes later, with his clumsy challenge on Junior Hoilett giving referee Graham Scott little choice but to award Cardiff a penalty, but Fabianski got down to his left to keep out Ralls' effort. 

Arnautovic's hopes of atoning for his error were cut short as he was forced off with a hamstring issue prior to half-time, and Perez made his mark four minutes after the restart, prodding in from close range. 

Perez swiftly doubled his tally with a cool finish through Etheridge's legs, with Antonio's header from Robert Snodgrass' corner completing West Ham's 12-minute burst. 

Superb saves from Etheridge prevented Angelo Ogbonna and Grady Diangana adding further gloss, and Murphy had the final say when he headed home following a goalmouth scramble in stoppage time.

What does it mean? Cardiff's away woes continue

It is now five away defeats on the spin for Neil Warnock's side, who remain just two points above the relegation zone heading into a huge bottom-of-the-table clash with Southampton.

West Ham, meanwhile, have claimed back-to-back league wins for the first time this term, moving them up to 12th place.

Sub Perez shines for hosts

It had been 700 days since Perez last scored a top-flight goal, in Arsenal's 3-3 draw with Bournemouth on January 3 last year, but the Spaniard – who is yet to start in the league for Manuel Pellegrini's side – made the most of his opportunity with two superbly taken goals.

Ralls lets Hammers off the hook

Ralls seemed to demand the ball ahead of Victor Camarasa in the build-up to Cardiff's penalty, but he never looked confident in the run up, with his effort lacking the conviction or direction to trouble Fabianski, leaving Warnock to rue what might have been.

Key Opta Facts

- West Ham have won consecutive Premier League games for the first time since January 2017.
- Cardiff scored just their third away goal in the Premier League this season - it was their only shot on target in the second half.
- Lucas Perez became the first West Ham player to score twice as a substitute in a Premier League match since Paulo Wanchope in April 2000.
- Lukasz Fabianski has saved each of the last three penalties he's faced in the Premier League, having saved just two of his previous 19 in the competition.
- Robert Snodgrass provided two Premier League assists in a game for the first time since December 2012 (for Norwich City against Swansea City).

What's next?

It's a London derby for West Ham, who face Crystal Palace on Saturday. Cardiff, meanwhile, host fellow strugglers Southampton, who have been linked with Ralph Hasenhuttl as they search for a new manager.