Yane Marques hung on for a thrilling women's modern pentathlon victory today at Toronto 2015 on a night where Brazil's Thiago Pereira equalled - and then broke - the all-time record for medals at the Pan American Games.
It came on a superb night for next year's Olympic hosts, with two gold medals also won in windsurfing and another in rhythmic gymnastics.
Marques, the London 2012 Olympic bronze medalist, led throughout the day-long competition, made all the more gruelling by the boiling hot conditions here today.
Marques, the Pan American Games champion at Rio 2007 and the silver medallist in Guadalajara four years ago, secured 18 victories in 21 matches to finished top of standings in the fencing ranking and bonus rounds before posting a leading 2min 12.18 in the 200 metres freestyle swimming to stretch her lead.
Following a solid performance in the showjumping she held a 36 point lead over Mexico's Tamara Vega going into the concluding combined shootrun discipline, which translated into a 36 second head-start in the first across the line format.
A strong running performance from the 31-year-old, however, was let down by several shooting errors, allowing Vega to cut the gap.
Both women entered the finishing straight locked together, before Marques edged clear to cross the line first by less than a second in 13min 41.25sec as each collapsed onto the ground in sheer exhaustion.
"When I saw her on the last lap, she was coming too close," Marques said.
"I knew I had to still work until the finish, I wanted the gold medal more than her.
"I finished almost dead, but proud.
“I wasted time on shooting, I made a mistake on the first and last lap but everything I did was enough to win the gold medal.”
Marques is raising the profile of a sport barely known in Brazil, but swimmer Pereira is already an established star who wrote himself further into the history books this evening with his 22nd and 23rd Pan American Games medals.
Having won six golds apiece at Rio 2007 and Guadalajara 2011 and two more relay ones earlier in these Games, he had already become the most successful swimmer in the history of the Games, despite the disappointment of being disqualified for a non-simultaneous touch after seemingly winning the 400m individual medley on Thursday (July 17).
Tonight he first won silver behind team mate Henrique Rodriguez - winner of the 200m individual medley in 1:57.06 - before claiming a medal as a reserve as Brazil beat the United States and Canada in the 4x100m medley in 3:32.68.
This put him above Cuban gymnast Erick Lopez, winner of 22 medals between Havana 1991 and Santa Domingo 2003.
Another Brazilian sporting legend did suffer disappointment today, however, as sailor Robert Scheidt, a 12-time world champion and the winner of medals at five different Olympic Games, had to settle for second behind Guatemala's Juan Maegli Aguero in the men's laser competition.
One major star who did triumph was US Opening Ceremony Flagbearer Kim Rhode, the shooter who has won Olympic gold medals at Atlanta 1996, Athens 2004 and London 2012.
She equalled the qualification world record mark of 74 set by Italy's Simona Scoccetti before overcoming Melisa Gil of Argentina, 15-12 in the final.
It was America's day as much as it was the Brazilians as golds were also won by wrestlers Josh Burroughs, Kyle Snyder and Zach Rey in their respective under 74, under 97 and under 125kg events, along with three in Games record times in the pool.
Teenager Sierra Schmidt claimed the 800m freestyle in 8:27.54 and Caitlin Leverenz won the 200m individual medley in 2:10.51, before the women's 4x100m medley relay quartet touched first in 3:56.53.
This proved enough for the Americans to overhaul Canada on the overall medals table.
They have now won 50 gold medals and a total of 135.
July 2015: Alvarez runs out of time before recovering to complete Toronto 2015 archery double
July 2015: Redemption for Overholt as teenager secures stunning swimming gold at Toronto 2015
July 2015: Cuba's López joins Pan American Games wrestling greats while United States dominate in pool
July 2015: Black and Calvo Moreno scoop double Toronto 2015 gold on final day of artistic gymnastics
July 2015: Colombian Cuesta wins weightlifting gold for fourth consecutive Pan American Games