The Bianconeri had taken one point from their previous two games after winning their first six of the season, but a win at Stadio Friuli means they are now just three points behind Napoli at the summit of Serie A.
The hosts took an early lead through Stipe Perica, but it was little surprise that a team who have scored more first-half goals than anyone else in the league this season responded in scintillating fashion.
A comical Samir own goal pulled Massimiliano Allegri’s side level before Khedira got the first of his treble with a fine header.
Mandzukic then received his marching orders midway through the opening period for two quick-fire yellow cards and Udinese took advantage of their numerical superiority just after the break as Danilo headed in.
Juve powered back, though, as a header from Rugani, two superb finishes from Khedira and a late Miralem Pjanic goal secured all three points and put the pressure on Inter and Napoli above them in the table.
Udinese started in emphatic fashion and were ahead after just eight minutes.
Perica picked Rugani’s pocket just inside the Juventus half before bursting towards the penalty area. The Croatian made light work of Giorgio Chiellini, turning the Italy defender inside out, and fired a crisp left-foot strike past Gianluigi Buffon for his first goal of the season.
Their lead did not last long, though, as the visitors pulled level in slapstick fashion in the 14th minute.
Pjanic’s corner was delivered with trademark precision, but Brazilian defender Samir got his positioning horribly wrong and sent a thumping header into his own net.
Chiellini failed to mirror Samir’s accuracy moments later with a back-post header before an incisive move resulted in Juve’s second after 20 minutes.
Juan Cuadrado ran into space down the right and delivered a teasing cross into the path of Germany international Khedira, who powered a header into Albano Bizzarri’s bottom corner to open his account for the season.
Gonzalo Higuain could have put Juve further ahead, crashing an instinctive shot against the post, before a moment of madness from Mandzukic handed the initiative to Udinese.
The Croatia striker was initially booked for confronting Ali Adnan after taking issue with a heavy tackle in the area and then received an immediate second caution for demonstrating vociferously to referee Daniele Doveri.
Clearly buoyed by the 31-year-old’s dismissal, Udinese started to display more attacking intent and Jakub Jankto was twice denied a leveller just before the break by two outstanding saves from Buffon.
Udinese started the second period in similar fashion to the first and equalised just two minutes after the restart.
Rodrigo de Paul sent in an inviting free-kick and Danilo took full advantage of some abysmal marking to send a close-range header past Buffon.
Juve did not have to wait long to reclaim the lead, though, as just five minutes later Rugani met a Paulo Dybala free-kick to send a header in off the post.
Another Dybala set piece led to Juve’s fourth in the 59th minute. The Argentine’s whipped ball was met by Rugani inside the six-yard box, but instead of going for goal the Italian opted to head down towards Khedira, who drilled a left-foot volley home from close range.
Khedira completed his hat-trick with a sweetly struck shot past an exposed Bizzarri in the 87th minute before Pjanic rounded off a memorable evening for Allegri’s side in injury time with a deflected shot from long range.
Key Opta stats:
– Juventus scored six goals in a Serie A game away from home for the first time since November 2012.
– Sami Khedira scored his first hat-trick in a competitive match since March 2008 (for Germany U21).
– Mario Mandzukic’s red card is the first shown to a Juventus player in Serie A since May 2016 (Alex Sandro v Verona).
– This was also Mandzukic’s first red card in a competitive game played for a club in the top-five European leagues (289 total appearances).
– The assist for Daniele Rugani’s goal was the first provided by Paulo Dyabla in Serie A this season.
– Juventus scored six goals with only five shots on target (one own goal, no save for Bizzarri).