Paul Pogba's brace bailed out Manchester United as Ole Gunnar Solskjaer's side stuttered to a fortuitous 2-1 win against West Ham.

Tuesday's huge Champions League quarter-final challenge in Barcelona looms large, but attention first turned to securing a return to European football's top table next season.

United moved within two points of the top four as a pair of Pogba penalties sealed victory at Old Trafford, but those in attendance will know how fortunate Solskjaer's side were to have secured a point, never mind three.

Felipe Anderson saw an early opener wrongly ruled out for offside, but the Brazilian cancelled out Pogba's contentiously-awarded penalty shortly after half-time as the Hammers capitalised on David De Gea's poor throw.

The United goalkeeper made amends as Manuel Pellegrini's men pushed for a winner, producing an outstanding one-handed save from Michail Antonio shortly after the West Ham substitute rattled the goalframe.

Yet the visitors returned to the capital empty-handed after Pogba smashed home his second spot-kick to keep up United's top-four charge on an evening when the performance will have alarmed Solskjaer.

The Red Devils stumbled out of the blocks and struggled to get going throughout.

West Ham played well from the outset and Anderson found the net after just 10 minutes when acrobatically meeting a header through from former United favourite Javier Hernandez.

But the linesman ruled the goal out for offside, despite right-back Diogo Dalot playing him onside.

It was a let off for the clumsy hosts, who took the lead against the run of play in the 19th minute.

Marcos Rojo looked rusty on his first start under Solskjaer but won the ball and fed Anthony Martial.

Juan Mata's attempt to reach the Frenchman's cutback were halted by a rash challenge by Robert Snodgrass, with referee Graham Scott having no hesitation in pointing to the spot despite the challenge occurring on the edge of the box.

Pogba took full advantage and sent West Ham goalkeeper Lukasz Fabianski the wrong way after deciding against his usual stuttered run-up.

The opener should have settled Solskjaer's men, yet Pellegrini's visitors continued to dominate for large patches and Dalot nearly turned into his own net before Anderson glanced across the face of goal.

Pellegrini let his frustration known to the officials as the sides made their way off for a half-time break from which West Ham returned with the bit between their teeth.

It took just four minutes for the men from the capital to draw.

Usually dependable De Gea's poor throw was read by Declan Rice and West Ham broke, with quick build-up play leading Manuel Lanzini to lift a cross to the far post for unmarked Anderson to squeeze home.

It was a gut punch that the Hammers looked to compound and De Gea saved Pablo Zabaleta's shot through a crowd as Solskjaer turned to Marcus Rashford to change the dynamics of the game.

That substitution would have reaped immediate rewards had Fabianski not been alert to deny the forward from an acute angle, with the forward heading over after Lanzini limped off.

Rojo tried his luck from distance but West Ham were pressing at the other end, with substitute Antonio rattling the crossbar before Anderson got away an attempt on De Gea's goal.

The hosts failed to heed that warning and their goalkeeper had to be at his world-class best to deny Antonio, whose header from Grady Diangana bounced off the ground and was bound for the top left-hand corner until an exquisite clawed stop.

It proved the decisive moment of the game as a minute later United were awarded a penalty after substitute Ryan Fredericks unceremoniously brought down Martial.

Pogba stepped up in front of the Stretford End and fired home his second spot-kick of the day.

West Ham tried to draw level but the only moment of note in the remaining 10 minutes was the accidental elbow from Rice that left Phil Jones with blood pouring from his head.