In the 93rd minute Erik ten Hag’s side were heading for a third defeat in a row at Old Trafford thanks to a first-half error from Andre Onana which had allowed Mathias Jensen to put the visitors in front.
But McTominay transformed the mood in Manchester, first firing in a rebound and then heading in from Harry Maguire’s flick-on to snatch all three points for United.
“That might be one of my favourite moments on a football pitch,” McTominay, who was only sent on in the 87th minute, said afterwards. “It was incredible. I’m just happy to contribute and show them that I can do it.
“Never give up, no matter what situation your life is in, never give up, never throw the towel in.
“At this football club, it’s the manner you never do that, for me I’ve been brought up since I was five years old here and I know that better than anyone.”
Brentford’s players – on the brink of a first win for their side at this stadium since 1937 – were crushed. They thought the offside flag had saved them when Kristoffer Ajer stuck the ball in his own net on 89 minutes – but there was still time for McTominay magic.
The victory lifts United up to ninth in the Premier League table and able to take a positive feeling into the international break after returning two wins from their previous seven across all competitions.
Brentford are down in 14th, three points above the bottom three and still waiting to add to their solitary win of the season.