The races came in one-person dinghy events, known in men's sailing as the Radial class and in women's sailing as Laser Radial.
There were four boats separated by a single point in the women's competition heading into Monday's medal race and a victory for any of them in the concluding trip around Weymouth Harbor would mean a gold medal.
Xu and Marit Bouwmeester of the Netherlands had 33 points to start the race while both Evi van Acker of Belgium and Annalise Murphy of Ireland had 34.
The winning boat would have two points added to its score, the second-place boat would receive four points and so on through the 10 competitors in the final race.
Xu got the first mark in front and she steadily increased her lead. Bouwmeester finished eight seconds behind and took the silver medal. Van Acker was the bronze medalist.
In the men's race, Australian Tom Slingsby began the medal race with a 14-point lead over Pavlos Kontides of Cyprus and was a massive 35 points in front of third-place Rasmus Myrgren.
Slingsby wound up ninth out of 10 boats in the medal race, but Kontides was 10th so Slingsby was never in any danger. The Australian finished with 43 points and Kontides had 59 to win the silver medal.
It was the first medal in Olympic history for Cyprus. Myrgren took the bronze medal, five points in front of Croatia's Tonci Stipanovic.