Manchester United got back to winning ways to keep in the running for a top-four finish, but were far from convincing against a bright Brentford side and had to dig deep for victory after their awful first-half showing.
Anthony Elanga, Mason Greenwood, and Marcus Rashford scored second-half goals, after United had been distinctly second best to Brentford, who might have been 3-0 ahead at half-time but for the goalkeeping of David De Gea.
Ivan Toney's late goal was all Brentford managed in the end, and Ralf Rangnick was the manager applauding his happy band of supporters at the final whistle. Whether Cristiano Ronaldo was smiling at the end was another question, however, after the Portuguese star had a little hissy fit when he was substituted in the 71st minute.
Even in victory, which was less comfortable than the scoreline suggested, there are still undercurrents of unhappiness at United and Rangnick will have his work cut out to lift this side into the Champions League places by the end of the season.
Brentford had the best of the opening exchanges and could count themselves unlucky not to go into half-time ahead. Three times they opened up the United defence, but each time De Gea came to their rescue.
It was also fortunate for United that the two clearest chances of the first half fell to midfielder Matthias Jensen rather than one of Brentford's strikers. In the 13th minute, the Dane found himself one-on-one with De Gea after a slip in United's midfield, but as he tried to steer the ball home from 12 yards, the big Spanish keeper stuck out a leg to keep ut out.
Jensen had an even better chance in the 32nd minute after a breathtaking break from the Bees. Bryan Mbeumo led the counter from defence, playing in Christian Norgaard who switched play to Toney on the left. The striker's pass put Jensen in on goal, but again De Gea stood tall before sticking out a foot to save the Dane's shot.
Brentford have begun talks with Christian Eriksen about a return to the Premier League, and it was another of their Danish contingent, Norgaard, who went close again with a half-volley that flew just over the bar after good work by Toney.
The big striker went close at both ends before the break, having a shot on the turn saved by De Gea, before almost scoring an own goal with an attempted clearance from a United corner.
Meanwhile, for the opening 45 minutes, United barely tested Jonas Lossl, the former Huddersfield keeper making his debut for Brentford.
Although Fred was bright and busy in the heart of midfield, United's passing was sloppy and their final ball was too often wasteful. Ronaldo was back, playing a lone striker role in place of Edinson Cavani, and barely had a sniff of goal apart from clipping the top of the crossbar with a header from a Bruno Fernandes' cross.
Brentford still had the better chances to break the deadlock. Jensen completed a hat-trick of misses when Mbeumo put him in on goal, but the Dane shot straight at De Gea. Five minutes later he tried to lob the Spaniard with an audacious effort from his own half but it proved to be a comfortable save for De Gea.
United then turned the game with two goals in the space of seven minutes. First, Elanga put them ahead with his first goal, a well taken effort alhough Lossl was at fault. Fred chipped a hopeful ball forward, Elanga got his right boot to the ball without getting it under control. It looped into the air, and Elanga climbed higher than the keeper to nod the ball over the line.
Emboldened, United started to believe they could score more, and the second goal was not far away. McTominay clipped a forward pass from deep, Ronaldo passed it with his chest to Fernandes, and the Portuguese ran in before slipping the ball across goal for Greenwood to tap home.
To defend his lead, Rangnick sent on Harry Maguire and Rashford, withdrawing Ronaldo, much to the superstar's obvious displeasure. He trudged slowly off the pitch with a face like thunder, and then sat gloomily in the dugout, barely celebrating when Rashford wrapped up three points in the 77th minute. McTominay was the architect, winning the ball in the centre-circle before shrugging off three challenges as he charged towards goal. Fernandes took over and laid the ball perfectly for Rashford to shoot high in at the near post from 15 yards.
But there was still time for more drama, this being United,a Toney stabbed the ball past De Gea from close range following a long throw, and Brentford sensed the sort of comeback Aston Villa managed at the weekend.
But United saw it out, even though Fernandes wasted a glorious chance to make it 4-1 by scooping the ball softly into the arms of Lossl.
BRENTFORD (3-5-2) Lossl 5; Sorensen 6, Jansson 7, Pinnock 7; Roerslev 6 (Baptiste 63), Norgaard 7, Jensen 6 (Wissa 67), Janelt 6 (Baptiste 63), Canos 6 (Henry 63); Mbeumo 8, Toney 7.
MANCHESTER UNITED (4-2-3-1): De Gea 8; Dalot 7, Lindelof 7, Varane 7, Telles 6; McTominay 8 (Matic 85), Fred 8; Greenwood 7 (Rashford 71), Fernandes 7, Elanga 7; Ronaldo 6 (Maguire 71).
Referee: Andre Marriner 7/10