It was a bright start from both teams and it was the Blades who should have gone ahead in the 11th minute when John Egan found some space on the edge of the six-yard box, but his header went over the bar.
Disaster then struck for the Hammers as goalkeeper Poland international Lukasz Fabianski, who has already spent a spell on the sidelines this season, injured his right hamstring in the 15th minute when taking a goal kick and was replaced by David Martin.
Chances were hard to come by for the remainder of the half although the visitors should have scored on the half-hour mark when John Egan’s poor header was pounced on by Felipe Anderson but, after driving into the penalty area, he dragged his shot wide of the bottom-left corner.
John Lundstram almost opened the scoring for United after he fired in a volley from 10 yards out towards goal, but Fabian Balbuena managed to get a solid block inside his own six-yard box and clear the danger.
Into the second half and John Fleck came close to opening the scoring, firing a shot from the edge of the box just wide, before the Blades did manage to take the lead on the 54th minute.
Scottish midfielder Fleck picked up on a terrible pass from goalkeeper Martin and drove into the penalty area before squaring to Oliver McBurnie, who just squeezed the ball under the keeper from close range.
Lys Mousset, on as a substitute forced a great save after being played into the box one-one-one, before Manuel Lanzini’s freekick from 24 yards called Dean Henderson into action, keeping the home side 1-0 ahead.
Late drama was to unfold as West Ham thought they had levelled the score in the 92nd minute when Robert Snodgrass fired a shot off the inside of the post and into the back of the net.
However, VAR checked for a handball in the build-up and Declan Rice, who assisted Snodgrass, was adjudged to have handled and the goal was chalked off.
United have climbed to fifth in the table with the victory, four points behind fourth-placed Chelsea, while the Hammers stay 16th and just two points above the drop zone.