Great Britain's reigning world omnium champion Trott led the six-event competition overnight but slipped to second going into the final event, the 500m individual time trial.
Trott needed to beat Sarah Hammer of USA by three places to guarantee gold. She duly obliged, winning the time trial in 35.110 seconds to finish on 18 points, Hammer's time of 35.9000 left her fourth and in silver position with 19.
The 20-year-old, double-Olympic champion, took Great Britain's gold medal tally to 21 so far – a feat that left her in shock.
“I can’t believe this has happened to me I really can’t," she said.
"I came in today not feeling as good as yesterday and I was losing my head a bit in between events because they weren’t going the way I wanted them to really then to finish off with that 500m I can’t believe it – I’m so happy.
“My coach Paul Manning got me to peak right on time really, I couldn’t ask for much more from the coaching staff.
"They’ve helped me improve so much since the worlds obviously with all our new equipment, that’s obviously helped. So it’s all thanks to the coaches really, my family and friends are here and the support of the crowd.
“I couldn’t have done it without them at all. The amount they had to put in when I was younger and take me here, there and everywhere was huge and I couldn’t have done it without them and I’m so happy and can’t thank them enough really.”
Australia’s Annette Edmondson took the bronze medal after finishing the omnium with a total of 24 points.