Christian Pulisic went close for the visitors before Tomas Soucek's effort at the other end on 34 minutes was ruled out for offside.
Pulisic was then fouled by West Ham's Issa Diop, and Willian calmly converted the penalty on 42 minutes.
But Soucek was not to be denied, heading in Jarrod Bowen's corner in first-half stoppage time.
Six minutes after half-time, Antonio swept in Bowen's cross to give the Hammers the lead.
Willian's stunning free-kick on 72 minutes levelled matters before Yarmolenko broke away to win it late on.
The Hammers move up to 16th place on 30 points.
Chelsea stay fourth on 54 points, one behind Leicester City.
West Ham: 5 July v Newcastle United (A)
Chelsea: 4 July v Watford (H)
West Ham: 5 Jul v Newcastle (A)
Chelsea: 4 Jul v Watford (H)