Gonzalo Higuain's late winner won Juventus the Derby d'Italia as the Serie A champions inflicted Inter Milan's first domestic defeat of the season.
Paulo Dybala opened the scoring inside the first four minutes with a left-footed strike, before Lautaro Martinez equalised for the hosts with a penalty awarded for handball by Matthijs De Ligt.
A nervy second half reached its summit when Cristiano Ronaldo teed up Higuain, and the Argentine kept his cool to strike past Samir Handanovic and bring Juve back into the lead with 10 minutes to go.
The guests held on for a famous win, as Inter suffered their first domestic defeat of the season and saw the Serie A champions leapfrog them to go top after seven games played.
How Juventus won the Derby d'Italia
Romelu Lukaku handed Inter a major boost as he returned to the starting XI to line up alongside Martinez after missing their midweek clash with Barcelona due to a quad injury.
Juventus coach Maurizio Sarri made one change in attack, as he replaced in-form striker Higuain with Dybala, while sticking with a 4-3-3 formation instead of bringing in Aaron Ramsey as an attacking midfielder.
The game got off to a flying start as Dybala won possession in the Inter half and dribbled his way to the box before unleashing a strike that flew between Milan Skriniar's legs and past Handanovic to give Juve an early lead.
Ronaldo could have added a second not long after as he spectacularly cut in from the left and dummied two defenders but his drive crashed off the crossbar and back into play.
Inter grabbed a deserved equaliser when De Ligt goofily hit a Danilo D'Ambrosio cross with his elbow and gave away a penalty, which Martinez coolly dispatched to bring Inter back on level terms.
Ronaldo thought he brought his side back in front when he hit the back of the net with a strike from the edge of the box - but the referee chalked off the goal for an offside by Dybala in the build-up.
The first half brought plenty of chances and entertainment, but the second half started off on a slower rhythm as the two teams brought down the tempo to a more tactical approach.
Dybala squandered a good chance by missing the target four yards out, before Marcelo Brozovic's deflected strike looked to have been heading in but curled away from goal and clipped the near post.
Higuain entered the fray with half an hour to go and left a mark with his first chance of the game - a great piece of team play saw Miralem Pjanic's defence-splitting pass find Ronaldo, who slid in Higuain for a one-on-one, and the super-sub emphatically finished off the move to bring Juventus back into the lead with 10 minutes to go.
Just like two seasons ago, a late Higuain strike stole the show at San Siro as Juventus held on to prove their title credentials in their bid for a ninth successive Serie A crown.
Inter suffered a halt to their perfect start to the league season after winning six games out of six, while Juventus took control of the Serie A table by leapfrogging their rivals by a point.
Inter coach Antonio Conte lost to his first game since taking charge of the club - and coincidentally his first defeat while at Juventus came against Inter.
Man of the match: Paulo Dybala
Brought in at the 11th hour for Higuain - who proved to be Ronaldo's perfect striking partner - Dybala did not disappoint Sarri's trust in him, breaking Inter's dogged defence with his first shot of the game. He looked inspired and confident on the ball, always dangerous in the final third and showed a brilliant chemistry with his team-mates despite recently losing his starting spot to his fellow Argentine Higuain .
Dybala proved to Sarri there shouldn't be any reason he should be overlooked in anyone's favour. The 25-year-old is one of the most technically gifted players in the squad and on a good day, he is a thorn in the flesh of any back-line in Europe - including the best one in the league, which conceded only two goals in six outings before the Juve star ran the show in their own backyard.