Mustafina finished ahead of defending Olympic champion He Kexin of China, who claimed silver with 15.933.
Great Britain's Beth Tweddle (15.916) won bronze - her first-ever Olympic medal in her last Games.
China's He was first to compete and produced a near-perfect routine. It was slightly down on her total in qualification but it set an impressive marker at the start of the final.
Victoria Komova, reigning world Uneven Bars champion who won silver in both the Team and Individual All-around events, was next and scored a disappointing 15.666 - despite a strong double-double landing after she caught the lower bar during her routine.
German Elisabeth Seitz, the last-place qualifier, moved into bronze medal position before China's Yao Jinnan overtook her and went into silver with a score of 15.766.
Tweddle then produced a beautiful routine, brimming with complexity and with the maximum difficulty on her dismount, but needed to take a couple of steps on her landing after she struggled with the last rotation.
I was hoping very much to win and I was very happy with my routine. I didn't know what to expect of myself today.Aliya Mustafina
The judges scored Tweddle's routine down on her 16.133 qualification mark, which moved her into silver medal position behind He.
Mustafina then stepped up and produced a breathtaking routine, pushing He into silver and Tweddle down into bronze medal position with two gymnasts still to come. They did not trouble the medal positions.
'I am very, very happy I've won gold,' Mustafina said. 'Every medal represents its own thing.
'I was hoping very much to win and I was very happy with my routine. I didn't know what to expect of myself today.'