Premier League - Rooney magic inspires United
In a disastrous start for the leaders, Mark Noble gave West Ham an 11th minute lead with a crisply-dispatched penalty after Patrice Evra handled in the United box following good work from Carlton Cole.
The forward won a second spot-kick in the 25th minute as Nemanja Vidic was lured into a rash challenge on the edge of the area and, though United were left aggrieved, Noble thundered another emphatic finish into the top corner of the net.
But two stunning strikes in eight second-half minutes from Wayne Rooney saw the striker net his 99th and 100th league goals for the club and level the scores with West Ham held firmly under the cosh.
Dimitar Berbatov and Javier Hernandez were both thrown on by Sir Alex Ferguson with his side trailing at the break, and the latter rounded off a fine victory with a close-range finish after Rooney had sealed his hat-trick, converting the third penalty of the match.
Berbatov was again confined to the substitutes' bench for United, while Tomasz Kuszczak was handed a starting berth in the absence of goalkeeper Edwin van der Sar, who suffered a tweak of his groin. Rooney led the line as the visitors' solitary forward, while instrumental midfielder Scott Parker passed a late fitness test for the Hammers.
United, who have won only four of 15 away league games this season, were looking to emulate their 4-0 league win at West Ham last season while the hosts, who were above the relegation zone on goal difference, sought their third home league win a row.
The first chance of the match fell the visitors' way as Ryan Giggs whipped over a deep corner to the back post, and defender Chris Smalling rose powerfully to force Robert Green into a sharp save, tipping the ball over the crossbar, with a header of real conviction in the fourth minute.
But the opener was to come at the other end as Cole latched on to a long ball and coolly brought it down into his stride before attempting to loop the ball over Evra's head, only for the defender to clearly handle the ball. Referee Lee Mason had no hesitation in pointing to the penalty spot.
United piled forward in their droves in a desperate bid to respond, but they were caught out at the back as Cole skipped past Vidic and was clumsily tripped by the Serb on the edge of the United box. The Serb protested vehemently, but referee Mason was unwavering.
Noble showcased part deux of his spot kick repertoire, unleashing a ferocious strike into the top right corner of the net with Kuszczak going the right way but still being comprehensively beaten by the sheer power of the finish.
Again United sought to hit straight back, but Ji-Sung Park was repelled by a stunning reflex save from Green, who dived low to his right to parry away a fierce strike from the midfielder on the half hour mark.
Further drama was to ensue in a pulsating first half as Vidic was again made a fool of, with the defender hauling down Demba Ba in hapless fashion 25 yards out, but referee Mason infuriated Avram Grant by only awarding the United skipper a yellow card.
It was a debatable decision, with Vidic the last man and Ba looking to outstrip the defender, but the close proximity of keeper Kuszczak appeared to vindicate the call.
Sir Alex Ferguson no doubt dished out a fearful rollicking to his players at the break - his touchline ban not prohibiting the half-time hairdryer blast - and the Scot reacted by withdrawing the ineffectual Patrice Evra and introducing Javier Hernandez in a tactical, but arguably enforced change.
The diminutive Mexican forward immediately gave the hosts a warning to heed as he darted past Lars Jacobsen and into the West Ham box, but his final touch eluded him and the chance went begging.
United grew increasingly frustrated as the Hammers repeatedly thwarted their forward ventures, and Ferguson promptly introduced Dimitar Berbatov at the expense of Park just after the hour mark.
The Bulgarian may not have made an immediate impact, but his presence on the field saw a free-kick awarded 25 yards out, with Rooney unfurling a quite exquisite strike which evaded the West Ham wall and beat Green to reduce the deficit. It was a stunning strike from the England forward and his 99th for the club in the league.
United proceeded to launch wave upon wave of attacks, and the West Ham back four was forced to work overtime to hold firm obdurately, but Rooney brought up his century with a stunning swivel and rasping strike eight minutes later, and the Hammers had seen their two-goal lead eroded.
The England forward clinched his hat-trick as he slammed his spot kick beyond Green with aplomb after Matthew Upson had been very harshly penalised for handball with Fabio drilling a low cross against his arm, and suddenly United had assumed the lead.
West Ham by this stage were weary and a touch despondent as United surged forward incessantly, and a fourth goal was added by the substitute Hernandez, who converted from close range to round off another fine move with Giggs instrumental.
As a result of the victory, United throw down the gauntlet to Arsenal and go eight points clear of their title-chasing rivals, who entertain Blackburn at the Emirates Stadium in the day's late kick off.