Mikko Rantanen had two goals and two assists, and Valeri Nichushkin had a goal and two assists for the Avalanche (41-20-5), who have won four in a row and six of seven. Justus Annunen made 25 saves.
"It's big, obviously, to get the confidence boost before we go to the playoffs because there's a lot of good teams in the West, a lot of additions at the (NHL Trade) Deadline that teams made," Rantanen said. "It's going to be tough, tough. If you want to win the West, it's going to be really tough. We want to get confidence in the last 15 or so games."
Daniil Miromanov and Walker Duehr scored for the Flames (31-29-5), who have lost three straight and four of five after a season-high five-game winning streak. Dan Vladar allowed six goals on 35 shots before he was replaced at the start of the third period by Dustin Wolf, who saved all three shots he faced.
"I think we got three good lessons here, simple as that," Calgary captain Mikael Backlund said. "Everyone in this room has to look at himself and be better. Next game, we have to play a lot better than we have the last three. Regardless of the result, just better effort, better systems, structure. Everything's got to be better."
Colorado scored five straight goals in the second period after trailing 2-1.
Josh Manson tied it 2-2 at 4:52 with a slap shot from the right point.
MacKinnon put the Avalanche ahead 3-2 at 5:50 with a one-timer from the left face-off circle over Vladar's left shoulder.
"I think when you're playing against him or even watching him, it might make you a little angry just wondering how he does it," Colorado forward Casey Mittelstadt said of MacKinnon. "He's a great player. There's very few guys in the world that can do that."