Laura Trott of Britain won the final event of cycling's omnium Tuesday to overtake Sarah Hammer of the United States for the Olympic gold medal.
Trott was trailing Hammer by two points heading into the last of six events, the 500-meter time trial, which meant she had to finish at least three spots better to win gold.
Trott won the race in 35.110 seconds while Hammer finished fourth in 35.900 seconds, giving Britain its sixth gold medal in eight events at the London Velodrome.
Hammer added another silver medal to the one she picked up behind Britain in the team pursuit, and Annette Edmondson of Australia finished second in the time trial to clinch bronze.
The newest event to the track cycling program, the omnium is similar to the heptathlon in track and field, or the individual medley in swimming. Its six events are spread over two days, with riders receiving one point for each position they finish in each race. The rider with the fewest points after all the events is the winner.
Trott finished with 18 points. Hammer had 19 and Edmondson had 24.
Trott and Hammer began the day tied with 12 points, but the British rider had shown perhaps a bit more speed during victories in the elimination race and flying lap on Monday.
The start of the second day of competition began with the 3,000-meter individual pursuit, which played right into the American's hands. The world record holder in the event, Hammer roared to a time of 3:29.554 that was nearly a second faster than Trott and moved her into the overall lead.
Tara Whitten of Canada finished third to remain close heading into the scratch race.
Trott and Hammer spent the first 15 laps of that 40-lap race safely in the bunch, only for Hammer to steal away on the attack. Trott reacted and the rest of the field quickly bunched back up.
With about four laps remaining, Hammer positioned herself right behind Trott, keeping a close eye on her closest competition. Hammer went to the front with two laps remaining, but Edmondson sneaked in front of her around the final corner to win the race, with Trott left sprinting for third.
That left Hammer with a two-point lead over Trott heading into the 500-meter time trial - two laps of the track to decide gold.
The far better sprinter, Trott covered the first 250 meters in 20.140 seconds, while Hammer only managed 20.828, their times on the velodrome screens generating a roar.
Trott maintained her advantage over the second lap, and with the rest of the field already finished, the 20-year-old Trott anxiously looked up to see if she'd beaten Hammer by enough.
It turned out she had - just barely.
The reigning world champion picked up her second gold medal of the Olympics after joining with Joanna Rowsell and Dani King to win the team pursuit. She also extended the dominance of the home nation on the Siberian pine surface of the velodrome.
Britain has the chance to eclipse its mark of seven gold medals won at the Beijing Games later Tuesday. Victoria Pendleton was contesting the women's sprint final against Australia's Anna Meares, and Chris Hoy was set to defend his title in the men's keirin.