Rooney's second saw him move onto 212 goals and usurp Jack Rowley as the third highest goalscorer in United's history, but it was his first just eight minutes into the 2-0 victory that will live long in the memory.
The 28-year-old produced a moment of magic, sending the ball sailing over Adrian in a goal similar in audacity and skill to Beckham's wonder strike at Wimbledon in 1996.
Rather aptly, the former United midfielder was at Upton Park to witness the effort first-hand and will have been impressed by the way Moyes' side held on to condemn West Ham to a third successive defeat.
Rooney's display was certainly a timely shot in the arm for United, with Robin van Persie facing up to six weeks out with a sprained knee.
His enforced absence was one of the six changes from the midweek win over Olympiacos, with the visitors impressing from the outset in east London.
One of those brought in, Marouane Fellaini, came close to putting the visitors ahead inside three minutes, powering a header goalwards only for Andy Carroll to hack off the line.
Moyes' side continued in the ascendancy and were almost then gifted a goal as Shinji Kagawa collected a miscued James Tomkins pass, allowing the Japan international to play in Juan Mata, who forced a good save from Adrian.
But the West Ham goalkeeper could only watch helplessly as Rooney netted his contender for goal of the season.
Having outmuscled Tomkins, Rooney turned and hit a half-volley which sailed over Adrian and into the net from fully 58 yards.
Beckham, watching on from the Upton Park stands, smiled wryly at the goal so similar to his own famous strike, which West Ham tried to chalk off immediately.
Mohamed Diame saw a drive blocked by Alexander Buttner, before Andy Carroll powered a header straight at David de Gea moments after glancing a Kevin Nolan free-kick wide.
Diame lost his footing just before getting a shot away as the home side continued to press, although they were leaving themselves open at the back.
When United next attacked Adrian had to be alert to deny Kagawa directing in a Mata through-ball, before the Spaniard stung the palms of the West Ham goalkeeper after wriggling free.
The visitors did not have to wait long to double their advantage, though.
As Nolan fumed at having a penalty appeal rejected by referee Lee Mason, United countered at speed with Rooney playing the ball right to Ashley Young.
The returning winger burst forward and sent in a low cross that Mark Noble could only hack into the path of Rooney, who easily directed home in the 33rd minute.
It moved him third in United's all-time scorers list and he attempted to add to that haul before the break, although failed with three efforts at a hat-trick
The Hammers returned from the break impressively and, after Young saw an effort saved at the other end, Diame had a strike blocked as West Ham attempted to carve open United's defence, which was holding firm despite Michael Carrick playing as a makeshift centre-back.
The England midfielder did well to head away as Tomkins lurked at the back post, before left-back Buttner failed with an attempt at the other end.
West Ham brought on Carlton Cole with less than 20 minutes remaining as they continued to pump balls into the box, while United made changes of their own, including the withdrawal of Rooney.
The England forward was given a loud ovation by the travelling faithful and a hearty round of applause by Beckham, while his display will have also pleased the watching Roy Hodgson.
Rooney's replacement Javier Hernandez would have added a third had Kagawa not sent a cross over the unmarked forward's head, while Fellaini unsuccessfully claimed a late penalty as Moyes' side secured a third successive away league win.
Source : PA
Source: PA