MacLennan, of King City, Ont., had the most points for difficulty and execution, posting a score of 57.305 to mark her first Olympic medal as well as the first time Canada's flag was raised at this year's Summer Games.
"I'm ecstatic, it hasn't quite hit me yet," MacLennan said. "I'm really happy."
Karen Cockburn, of Stouffville, Ont., was denied a fourth medal in the event, finishing in fourth with 55.860 points.
China took silver and bronze, with Huang Shanshan in second with 56.730 points and defending world champion He Wenna in third with 55.950.
MacLennan sat in first spot after her performance and Cockburn told her teammate that the dazzling 10-trick performance would stand up as the best.
"Rosie was really strong, her score was huge," Cockburn said. "The other gymnasts could feel the heat after her score. I wasn't really surprised that she won. We pushed each other hard in training, I'm really happy for her."
The newly-minted Olympic champion wasn't convinced at the time.
"I didn't want to get too ahead of myself," MacLennan said. "I was shocked. It's the biggest score that I've ever gotten and I knew that it would be a tough one to catch. But you never want to get ahead of yourself, you want to wait until all the competitors are done."
With the two Chinese athletes — and medal favourites — left to compete, it wasn't until He lost control at the tail-end of her routine that the gold medal was assured for the Canadian.
Meanwhile, this marks the end of Olympic competition for the 31-year-old Cockburn. After taking bronze in the event's debut at the 2000 games in Sydney, Cockburn finished second in both Athens and Beijing and was hoping for one last medal as she headed into retirement, missing bronze by less than 0.1 points.
"Of course fourth is the worst place to finish, but of course I am really happy for Rosie," Cockburn said in a release. "So it's mixed emotions. At the end I thought I was for sure going to be fourth, then the Chinese competitor fell and I thought for sure I was going to be third. I
"It was pretty disappointing but obviously I'm really happy for Rosie. It's a good thing for Canada to win a gold medal. I was happy with my routine, I was happy across the board."