Antonio Nocerino gave Milan a 14th-minute lead and Sulley Muntari appeared to head the second goal soon after, TV replays clearly showing the ball had gone over the line before goalkeeper Gianluigi Buffon clawed it away, but play was waved on.
Juve made the most of their escape and salvaged a point with seven minutes to go when substitute Alessandro Matri smashed in a right-foot volley from close range, just after he had a goal disallowed in another refereeing controversy.
Leaders Milan stayed one point clear at the top, with 51 points from 25 matches. Juve, who had Arturo Vidal sent off after 89 minutes, have a game in hand.
Juve have gone 27 league and cup matches this season without defeat and had already beaten Milan once in each competition.
"There's no sadness, we played a good match," Milan coach Massimiliano Allegri told the club's website. "The 'goal' would have damaged them and it would have been a different game."
Opposite number Antonio Conte told Sky Sports Italia: "I can say that two good goals were disallowed. I don't think Matri's counts for less."
Argentine striker Rodrigo Palacio scored twice in the last 18 minutes to give 10th-placed Genoa a 2-2 draw at home to Parma, who are 13th, in Saturday's other game.
Massimo Gobbi and Sergio Floccari netted early in each half for the visitors.
Milan dominated the first half despite the absence of top scorer Zlatan Ibrahimovic, who was serving the third game of a three-match ban, while Juve took control in the second period in an open contest full of dramatic twists.
Juve, with playmaker Andrea Pirlo disappointing against the club where he spent 10 seasons, had trouble passing their way out of defence throughout the first half and gifted Milan their goal.
Leonardo Bonucci sent the ball straight to Urby Emanuelson and the Dutchman quickly fed Nocerino who scored with a 25-metre shot which deflected in off the hapless Bonucci.
The turning point came soon after when Philippe Mexes met Emanuelson's cross with a powerful header that Buffon parried straight to Muntari.
The Ghanaian's header clearly crossed the line before being pushed away by the goalkeeper but, while Milan's players celebrated, the referee waved play on amid general bewilderment.
"I'm going to be honest, we were let off in that situation but it went the other way in the second half. The game should have ended 2-2," Buffon told Juve's website.
Juve broke away immediately after the incident and nearly stole an equaliser when Marcelo Estigarribia's shot was turned away by Christian Abbiati.
Milan forward Robinho was in inspired form, showing the dribbling ability and trickery which earned him the nickname the 'King of the Stepovers' in his native Brazil, and forced Buffon to dive at his feet to prevent a second goal.
Juve forwards Matri, Mirko Vucinic and Simone Pepe,
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.