Samantha Murray won modern pentathlon silver for Great Britain in the final event of the London 2012 Olympic Games.
The 22-year-old world bronze medallist started the run-shoot finale eight seconds off the pace, but caught up to finish a superb second.
Lithuania's Laura Asadauskaite won as GB's Mhairi Spence, the world champion, finished 21st.
British pentathletes have now won medals at all four Games since the women's event was introduced in 2000.
"I had a lot to make up on the run, I needed that," said Murray. "I've made a few mistakes today which set me back, but I came through in the end.
"I'm just so pleased, my legs kept running for me. Up the hills was so steep and I just kept working hard."
The very last medal of the London Olympics was fittingly won by Brazilian Yane Marques, ahead of her home Rio Games, who took bronze.
Lancashire's Murray had two fences down in the showjumping after a strong swim, having recovered well from a miserable start in the morning's fencing, then produced the coolest of run-shoot performances to secure a medal.
"Four years ago I was doing my A levels at school. I'd started pentathlon but I was by no means performing on an international level," she said.
"Since then I've come through the ranks, won some medals along the way and made it to the Olympic Games.
"Honestly, if you have a goal - if there's anything you want to achieve in life - don't let anybody get in your way. You can do it. If I can do it, and I'm a normal girl, anyone can do what they want to do."
Scotland's Spence, the other Briton in the event, could not recover from a tough showjumping round.
The 26-year-old began the day by winning 19 of her 35 one-minute fencing contests while Murray won 18, despite losing her first seven in a row.
But Murray is a much stronger swimmer and swam her 200m freestyle heat in two minutes 8.20 seconds, just behind the Olympic record of Hungary's Sarolta Kovacs.
Spence swam her heat in 2:16.51 and then suffered a roller-coaster ride on board Coronado's Son in the jumping, clinging on for dear life at times and incurring four downed fences plus time penalties.
Murray fared better on Glen Gold with two fences and minor time penalties to her score, leaving her in touch with the leading trio, headed by Asadauskaite.
The combined run-shoot event works by sending off athletes in staggered starts according to the number of points they picked up earlier in the day.
Murray started the finale in fourth, eight seconds behind Asadauskaite, with Spence 38 seconds off the lead.
Athletes complete a 3km running course with three rounds of shooting interspersed.
Murray had moved up to third by the mid-point, then surged into second place as the Greenwich Park crowd roared one last time.