After collecting the ball wide on the left, Masuaku arrowed a cross-cum-shot past Chelsea goalkeeper Edouard Mendy at his near post to send the Hammers supporters into ecstasy.
Thiago Silva broke the deadlock for Chelsea in the first half, heading Mason Mount’s corner past Lukasz Fabianski via the inside of the post.
West Ham were gifted a chance to equalise when Edouard Mendy brought down Jarrod Bowen following a poor backpass from Jorginho, allowing Manuel Lanzini to stroke home from the penalty spot.
Bowen’s low drive from the edge of the area restored parity once more before Masuaku’s remarkable 87th-minute winner.
The win consolidates West Ham’s place in the top four, while Chelsea will drop to third if Manchester City and Liverpool win this weekend.