Match ends, Juventus 1, Manchester United 2.
Manchester United stunned Juventus with two goals in the final five minutes to beat the Italian champions in Turin and give themselves a good chance of qualifying for the Champions League knockout stages.
Juan Mata curled in a free-kick with five minutes to go, before Ashley Young's set-piece was bundled into his own net by Juventus defender Alex Sandro.
Cristiano Ronaldo had put the hosts ahead with an outstanding volley against his former club.
Ronaldo watched Leonardo Bonucci's long pass over his shoulder before lashing it past United goalkeeper David De Gea for his first goal in the competition since signing for the Serie A leaders.
Juventus had hit the frame of the goal either side of half-time, with Sami Khedira striking a post and Paulo Dybala curling an effort on to the bar.
Jose Mourinho's side offered little attacking threat at the other end, until substitute Mata beat goalkeeper Wojciech Szczesny with a well-placed free-kick from the edge of the box in the 86th minute.
Three minutes later and another United free-kick proved Juventus' undoing, as Young's in-swinging delivery was inadvertently turned in under pressure by Sandro from close range.
The visitors' late double keeps them second in Group H and two points above Valencia, who beat Young Boys 3-1 in the early kick-off, with two games still to play.
- Did Mourinho's celebrations go too far or show passion?
- United 'one final' from knockout stage - Mourinho
- Why Juve are much more than Ronaldo
United leave it late... again
United have made a habit of staging late recoveries this season, although manager Mourinho bemoaned his side's inability to do so when they were beaten by Juventus at Old Trafford last month.
But, while comeback wins over Newcastle and Bournemouth in the Premier League offered relief rather than the chance to rejoice, this victory was more reminiscent in its nature of United's Champions League triumph over Bayern Munich in 1999.
Mourinho's side look a long way from winning the competition 20 years on, but his players' reaction at the final whistle - and Mourinho's cupped ear to the Juventus fans - showed how important taking three points in Turin was to the Reds.
Juventus had won three from three and were yet to concede a goal in the Champions League this season before Mata's strike, while United's late winner inflicted only the Serie A champions' second loss at home in the group stages in 36 games.
United - without Belgium forward Romelu Lukaku, who is also a doubt for Sunday's Manchester derby - opted for Alexis Sanchez to lead the line, but the Chilean had a bigger influence on the visitors' defensive performance than he did their attack.
The same could be said for Anthony Martial, who tracked Juventus right-back Mattia De Sciglio relentlessly as United defended resolutely before Ronaldo's opener.
But United, who had just three shots on target, proved clinical in attack when it mattered and will progress from the group if they beat Young Boys at home later this month and Valencia fail to beat Juventus.
Showstopper Ronaldo upstaged in Turin
It was always going to happen, wasn't it? Ronaldo scoring his first Champions League goal for Juventus against former club United.
The Portugal forward, who joined the Italian outfit from Real Madrid for £99.2m in the summer, was without a goal in the competition since scoring against Juve for his former side in April.
But Ronaldo's first in Europe for the Serie A leaders was worth waiting for, showing superb technique to volley in Bonucci's well-weighted long pass for the opener.
The five-time Champions League winner had struggled to make an impact on the tie before his moment of brilliance, though it was from his pull-back that Khedira struck a post in the first half.
Dybala was unlucky to not put the hosts ahead moments after Khedira's chance when he cut inside and curled a dipping effort against the crossbar, while De Gea had earlier produced an instinctive save after Juan Cuadrado's cross was deflected goalwards by Nemanja Matic.
But when the goal came, it was worthy of a player who has won the Ballon D'Or five times, and the 33-year-old celebrated in trademark fashion - lifting up his shirt to reveal his muscular physique.
Ronaldo thought he had stolen the show, but the Portuguese, and his Juventus team-mates, were upstaged by United's late twist.
Man of the match - Juan Mata (Manchester United)
What they said - 'It is a big victory for us'
Manchester United manager Jose Mourinho on BT Sport: "A point or three would have changed little for Juventus, but three points makes a big difference to us.
"It is a big victory for us, not just because we needed the points but because it was away from home against an amazing team.
"They are a fantastic team with an amazing record at home. We had to come and not feel inferior. They have more potential than us. Everybody knows their ambitions."
Manchester United goalscorer Juan Mata: "What a nice last five minutes. It is a very good night for us to get three points against Juventus in Italy. It is amazing.
"They have fantastic players and are a top team. We come back to Manchester with three points and that is football."
The stats - United party like it's 1999
- Juventus lost a Champions League group stage home game for the first time since December 2009, when Bayern Munich beat them, ending a 19-game unbeaten run.
- United have won more away Champions League matches at Juventus than any other side have in the history of the competition, with three.
- United have come back to win a Champions League game with two goals in the final five minutes of a match for the first time since the 1999 final against Bayern Munich.
- Juan Mata scored his first Champions League goal since netting against Wolfsburg in September 2015.
- Cristiano Ronaldo ended a drought of 20 shots and 453 minutes without a goal in the Champions League.
United make the short trip to Etihad Stadium on Sunday to face rivals Manchester City, kick-off 16:30 GMT, while their next Champions League outing is against Young Boys at Old Trafford on 27 November.
Juventus face a big game of their own on Sunday, visiting manager Allegri's former club AC Milan in Serie A in a 19:30 kick-off. They host Valencia next in Europe.
- 2De SciglioSubstituted forBarzagliat 83'minutes
- 12Lobo SilvaBooked at 55mins
- 16Ju CuadradoSubstituted forMandzukicat 90+2'minutes
- 6KhediraSubstituted forMatuidiat 61'minutes
- 10DybalaBooked at 75mins
- 7Cristiano Ronaldo
- 1De Gea
- 21HerreraBooked at 75minsSubstituted forMataat 79'minutes
- 31MaticBooked at 12mins
- 14LingardSubstituted forRashfordat 70'minutes
- 7SánchezSubstituted forFellainiat 79'minutes
- 11MartialBooked at 90mins
- Ovidiu Hategan
- Shots on Target
Second Half ends, Juventus 1, Manchester United 2.
Anthony Martial (Manchester United) is shown the yellow card.
Rodrigo Bentancur (Juventus) wins a free kick in the defensive half.
Foul by Anthony Martial (Manchester United).
Corner, Manchester United. Conceded by Wojciech Szczesny.
Attempt saved. Marcus Rashford (Manchester United) right footed shot from the centre of the box is saved in the bottom left corner. Assisted by Anthony Martial.
Hand ball by Ashley Young (Manchester United).
Giorgio Chiellini (Juventus) wins a free kick in the defensive half.
Foul by Marcus Rashford (Manchester United).
Substitution, Juventus. Mario Mandzukic replaces Juan Cuadrado.
Attempt missed. Leonardo Bonucci (Juventus) right footed shot from outside the box is close, but misses to the left. Assisted by Miralem Pjanic.
Own Goal by Leonardo Bonucci, Juventus. Juventus 1, Manchester United 2.
Foul by Andrea Barzagli (Juventus).
Marcus Rashford (Manchester United) wins a free kick on the left wing.
Attempt missed. Paulo Dybala (Juventus) left footed shot from outside the box misses to the right. Assisted by Juan Cuadrado.
Goal! Juventus 1, Manchester United 1. Juan Mata (Manchester United) from a free kick with a left footed shot to the top left corner.
Foul by Blaise Matuidi (Juventus).
Paul Pogba (Manchester United) wins a free kick in the attacking half.
Attempt missed. Marouane Fellaini (Manchester United) header from the centre of the box misses to the right. Assisted by Ashley Young with a cross.