Juventus moved third, three points behind leader AC Milan and one below Inter Milan, which beat Bologna 3-1. Milan visits Sampdoria on Sunday.
Torino remained in the relegation zone, two points from safety, with only six points from its first 10 matches.
Cristiano Ronaldo had been rested for last week’s disappointing draw at newly promoted Benevento but had scored his 750th career goal midweek, against Dynamo Kyiv in the Champions League, and was back in the starting lineup again on Saturday.
Torino stunned Juventus by taking a shock lead in the ninth minute as the home defense failed to deal with a corner and the ball came through to Nkoulou, who tapped it in from close range.
Juventus had only one shot on target in the first half and didn’t really improve after the break. Cuadrado thought he had leveled but it was ruled out as Bonucci was offside.
Cuadrado did help to set up the equalizer when, following a corner, he floated the ball back into the area for McKennie to head into the bottom right corner.
Juve’s winner was almost identical as Cuadrado put in another cross and Bonucci headed in from the same position as McKennie.
“When you can’t get the scoreline you want through your play, you have to do so through your spirit and DNA,” Juventus coach Andrea Pirlo said. “We have to improve and move the ball faster, otherwise we give our opposition too much time to get into their positions.”
It opened the scoring in the 15th minute with a classic counterattack. Milinković-Savić stole the ball off Spezia midfielder Giulio Maggiore and immediately played it to Ciro Immobile, who burst into the box and slotted it through the goalkeeper’s legs for his ninth goal in his last eight matches.
Immobile also won the free kick which Milinković-Savić curled into the top left corner in the 33rd.
Spezia pulled one back in the 64th when M’Bala Nzola went down the right and then cut inside before firing into the far side of the net.
More AP soccer: https://apnews.com/Soccer and https://twitter.com/AP_Sports