MacKinnon gave the Avalanche a 1-0 lead late in the first period and capped a three-goal flurry in the second that put Colorado ahead 4-0.
The Sharks struck back with consecutive scores by Joe Pavelski, Patrick Marleau and Logan Couture, but Avalanche goalie Semyon Varlamov closed the door after that, making several sparkling saves down the stretch.
Marleau added two assists for San Jose, which dropped a second in three games.
Antti Niemi started in net but was lifted in the second period after yielding three goals on 14 shots.
Alex Stalock stopped 6-of-7 the rest of the way.