James left herself with a lot of ground to make up on the final lap, starting from the back of the pack and accelerating past all but eventual winner Elis Ligtlee of the Netherlands in the final lap.
Anna Meares (Australia) came in for third to claim bronze.
It's a remarkable result for James, having spent nearly two years out of competition due to injury since winning two world sprint titles in 2013.
The Welshwoman showed that she was making progress in March, when she took bronze in the track world championships in London. In Rio, she went one better to take her first Olympic medal.
Earlier on Saturday, GB had claimed gold in the women's team pursuit on their way to setting another world record.
Rio 2016 Olympic Games, women's keirin finals
1. Elis Ligtlee (NED) 11.217 [gold medal]
2. Becky James (GBR) +0.033 [silver medal]
3. Anna Meares (AUS) +0.038 [bronze medal]
4. Anastasiia Voinova (RUS) +0.111
5. Liubov Basova (UKR) +0.152
6. Kristina Vogel (GER) +0.163
7. Lee Wai Sze (HKG) 11.407
8. Lee Hyejin (KOR) +0.059
9. Laurine Van Riessen (NED) +0.140
10. Martha Bayona Pineda (COL) +0.220
11. Tianshi Zhong +0.445
12. Simona Krupeckaite (LTU) +04.464
Round two heats
1. Kristina Vogel (GER) 11.288
2. Elis Ligtlee (NED) +0.398
3. Anastasiia Voinova (RUS) +0.533
4. Tianshi Zhong (CHN) +0.630
5. Hyejin Lee (KOR) +1.046
6. Martha Bayona Pineda (COL) DNF
1. Anna Meares (AUS) 11.135
2. Becky James (GBR) +0.006
3. Liubov Basova (UKR) +0.036
4. Laurine Van Riessen (NED) +0.159
5. Simona Krupeckaite (LTU) +0.192
6. Lee Wai Sze (HKG) DNF
Thank you for reading 5 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1