The England striker side-footed into an empty net after Javier Hernandez had raced in behind the visitors’ defence and squared.
Sir Alex Ferguson’s side will now face Fulham at home in the last 32.
There was a tinge of sadness for Rooney, however, who dedicated his goal to his late sister-in-law Rosie, who died on January 5th.
He then went on to miss a second-half penalty, blazing his effort over the bar as West Ham threatened to mount a comeback.
Ferguson made 10 changes to his team and the disruption showed in a below-par performance that lacked cohesion and tempo.
They started well and deservedly took the lead, but failed to build on their advantage, with their only other clear chance of the first half being a shot from Nani that was kicked off the line by Dan Potts.
West Ham lacked penetration in the opening period but fared far better after the break and had several opportunities to draw level.
They could have had a penalty shortly after the restart when the ball struck Rafael’s arm, but referee Phil Dowd waved play on.
United were then fortunate that the Brazilian right-back was in the right place to prevent Matt Taylor’s square ball reaching Ricardo Vaz Te.
Taylor later curled an excellent chance over, before Chris Smalling managed to nick the ball away from Kevin Nolan just as the Hammers substitute was about to shoot from close range.
United should have put the game beyond doubt after Jordan Spence handled the excellent Ryan Giggs’ cross, but Rooney missed from the penalty spot.