Leeds went ahead in the 19th minute with a brilliant composed finish from Raphinha whose drive from the edge of the box flew into the bottom left corner following strong work from Rodrigo and Mateusz's Klich cool's pass.
Raphinha was then denied a very similar second goal as another shot from the edge of the box cannoned back off the post and Stuart Dallas was earlier kept out by a fantastic save by Lukasz Fabianski.
But Illan Meslier had earlier pulled off two fine stops to deny both Michail Antonio and Said Benrahma as the Hammers made a bright start and the Frenchman thwarted the visitors in first half stoppage time to deny Pablo Fornals who had been played in one on one.
Leeds United ‘express interest’ in transfer as ‘decision made’ over player’s future
What is happening to former Leeds United star Raphinha at Barcelona amid latest farce and deadline
Leeds United and Crystal Palace ‘monitoring’ £30m striker, Whites could be ‘offered’ Aston Villa star
Leeds United dealt Patrick Bamford injury blow at Southampton with fellow striker already out
Injury crisis deepens for Leeds United's Premier League rivals as another star limps off
The returning Jack Harrison then replaced Dan James at the interval and West Ham looked to have equalised in the 53rd minute when Tomas Soucek netted from close range after a free-kick.
But Antonio had knocked down Meslier with his arm and the goal was disallowed after referee Kevin Friend checked his monitor via the intervention of VAR.
West Ham then drew level in the 67th minute when Jarrod Bowen cut in from the right and unleashed a fierce drive that took a deflection off Junior Firpo to fly past Meslier.
Tyler Roberts was then brought on for Raphinha but West Ham finished the stronger and bagged the game's winning goal when Leeds were carved open through the middle and Declan Rice played in Antonio who beat Jamie Shackleton before slotting a finish past Meslier in the 90th minute.
Leeds United: Meslier, Shackleton (Summerville 90), Cresswell, Cooper (c), Firpo, Phillips, Dallas, Klich, Raphinha (Roberts 69), James (Harrison 46), Rodrigo. Subs not used: Klaesson, McCarron, Drameh, Hjelde, Gelhardt, Greenwood.
West Ham United: Fabiański, Coufal, Zouma, Ogbonna, Cresswell, Rice (c), Souček, Bowen (Dawson 90), Benrahma, Fornals (Vlasic 78), Antonio (Yarmolenko 90). Subs not used: Areola, Johnson, Diop, Noble, Král, Lanzini.
Referee: Kevin Friend.
A message from the Editor:
Leeds has a fantastic story to tell - and the Yorkshire Evening Post has been rooted firmly at the heart of telling the stories of our city since 1890.
We believe in ourselves and hope you believe in us too. We need your support to help ensure we can continue to be at the heart of life in Leeds.
Subscribe to our website and enjoy unlimited access to local news and information online and on our app.
With a digital subscription, you can read more than 5 articles, see fewer ads, enjoy faster load times, and get access to exclusive newsletters and content.
Click here to subscribe.
For more details on our newspaper subscription offers click here.
Thank you Laura Collins