Wayne Rooney's reckless dismissal did not stop Manchester United from returning to winning ways as they edged past West Ham United on a nervy afternoon at Old Trafford.

Rooney became the third-highest scorer in Premier League history when he opened the scoring for United with a deft volley and Robin van Persie doubled the lead with his 50th goal for the club.

Rooney then put his team's chances in jeopardy by kicking out at Stewart Downing, but despite Diafra Sakho's header making it awkward, Louis van Gaal's side held on for a 2-1 win.

Just like in last week's shock defeat to Leicester, United looked very impressive at times going forward.

The attacking trio of Rooney, Van Persie and Radamel Falcao combined well up front, until the United captain was sent off in the 59th minute for the foul, which occurred deep inside his own half.

At the back, United looked vulnerable once again, although in fairness to Van Gaal, his injury troubles were so bad that he had to give 19-year-old centre-back Paddy McNair a debut.

Of more concern to Van Gaal will be Rooney's absence, which will last three matches if the dismissal is deemed to be violent conduct by the Football Association.

That would rule the United skipper out of the forthcoming games against Everton, West Brom and Chelsea - three games United will want to win to put themselves firmly back in the hunt for the Champions League places.

The desire to put last week's capitulation to bed was clear from the first whistle.

United hit West Ham with attack after attack, and it took less than five minutes for the hosts to break the deadlock.

Rafael sprinted down the right flank after dinking the ball over Aaron Cresswell. The Brazilian paused and crossed for Rooney, who volleyed past Adrian after one bounce.

The expert execution of the volley across the West Ham goalkeeper was befitting of a striker whose Premier League scoring record is only bettered by Andy Cole and Alan Shearer.

United's creaky defence almost cost them the lead within one minute of Rooney's goal.

Daley Blind's miscued clearance landed straight into the stride of Enner Valencia, but he blasted into the Stretford End.

It was a let-off for the hosts, who quickly sought to settle the nervy home crowd with a second goal.

Rooney found Van Persie at the back post with a delightful cross, but the Dutchman headed wide.

Angel di Maria shot high and wide from inside the West Ham box and Rooney then fluffed a shot inside the area.

Van Persie had no such trouble in the 23rd minute when he put United 2-0 up.

Adrian put Alex Song under pressure with a poor clearance and United took full advantage. Ander Herrera nicked the ball off the Barcelona loanee and Van Persie angled his shot past the West Ham goalkeeper after a clever pass from Falcao.

For all their attacking brilliance, at the back United still looked suspect.

Song slipped Sakho in behind, but Marcos Rojo raced across to put in a vital tackle.

Sakho found the net a few minutes later though, due to a rare error from David de Gea. Song hit the bar with a header after the Spaniard flapped at a corner and the ball fell to Sakho, who headed into an empty net.

Sakho put McNair under pressure as United desperately tried to hold on to their lead before the break.

After the break, West Ham continued to press. Aside from a shot by Falcao, United offered little on the attack.

Slack marking from debutant Luke Shaw allowed Sakho to sting De Gea's palms with a fierce volley.

United looked shaky in the face of West Ham's attacking play, and their task was made much harder when Rooney was sent off just before the hour.

The United captain, unable to catch Downing, kicked the midfielder from behind while he was at full pace.

Referee Lee Mason blew his whistle and then, to the shock of the home fans and players, showed Rooney his first red card for United in five-and-a-half years.

Van Gaal looked to shore up his team by bringing Darren Fletcher on for Falcao.

West Ham sent Carlton Cole on and looked to press home their numerical advantage.

Sakho rippled the side-netting and Valencia's deflected shot flew inches wide as West Ham piled on pressure.

Herrera hobbled off with a back injury before McNair made a goal-saving header deep inside the home box.

Kevin Nolan turned in Carl Jenkinson's cross in the 89th minute, but linesman Andrew Garratt flagged for offside and United held on to record the second win of Van Gaal's tenure.