The win leaves Juve in seventh place with 13 points from eight games as they trail leaders Napoli by seven points.
"It is a clean and important win, we have not been winning for a month. The guys were good, we are keeping a low profile because we are still behind," Allegri told DAZN.
Juve midfielder Kostic fired home a diagonal drive to score the opener in the 24th minute for his first Serie A goal after being played through by his Serbia team mate Vlahovic.
Forward Arkadiusz Milik came close to extending the lead some 15 minutes before halftime as he tried to slot home an Alex Sandro cross but he was denied by Skorupski.
Vlahovic then scored with a header in the 59th minute following a superb cross by McKennie before Milik smashed the ball into the net from inside the box three minutes later.
"Milik is a player who can play soccer really well, but most importantly he can play well with Vlahovic," Allegri added.
Vlahovic could have netted again in the 67th, but his strike went wide. That was followed by another effort from Milik four minutes later but his header crashed against the post.