Diaz, who had earlier hit the post, netted midway through the second half as Porto were rewarded for their dominance in a game in which they missed a number of chances and barely gave Milan a sniff at the other end.
Milan, who will host the Portuguese side on Nov. 3, were possibly justified in believing there was a foul in the build-up to the goal, but neither German referee Felix Brych nor the video assistant agreed.
Porto stay in third place at the midway point of the pool with four points from three games, behind Atletico Madrid (four points) on goal difference, and leaders Liverpool (nine). Milan have yet to break their duck having lost all three matches.
There were few chances in the first half, but the best fell to the home side and in particular Iran international Mehdi Taremi, who was wasteful on the night.
Diaz came the closest to scoring as his fine run and low drive from the edge of the area cannoned back off the post.
Taremi should have hit the target when he steered a shot wide from 12 yards, and then had a header flash the wrong side of the post.
At the other end Milan forward Olivier Giroud opted to head across goal in search of a team mate when he should have been more selfish at the back post in what was the visitors' best chance of the game.
Taremi had an effort go inches wide early in the second period as Porto continued to look the most likely to make the breakthrough, finally getting their reward on 65 minutes, though in controversial circumstances.
Taremi appeared to barge into Milan midfielder Ismael Bennacer as both went for a high ball, which eventually fell to Diaz on the edge of the box and this time he shot low into the net.