In harrowing images, 25-year-old Anita Alvarez could be seen floating toward the bottom of the pool, apparently unconscious, after completing her solo free routine.
Her coach, Andrea Fuentes, who previously won four synchronized swimming Olympic medals for Spain, leapt into action, the Olympic Games said on its news blog.
In photos, Fuentes, still fully clothed in a T-shirt and shorts, can be seen swimming to Alvarez before pulling the swimmer up toward the surface of the water.
She can then be seen dragging Alvarez, a two-time Olympian, toward the edge of the pool with the help of an unidentified man.
Alvarez was given medical attention before being stretchered away, according to the Olympics Games website.
In a statement shared on the USA Artistic Swimming Instagram page, Fuentes said: "Anita is okay" after the harrowing incident.
"The doctors checked all vitals and everything is normal: heart rate, oxygen, sugar levels, blood pressure, etc… all is okay," she said.
"We sometimes forget that this happens in other high-endurance sports. Marathon, cycling, cross country," she continued. "We all have seen images where some athletes don’t make it to the finish line and others help them to get there."
"Our sport is no different than others, just in a pool, we push through limits and sometimes we find them," she said. "Anita feels good now and the doctors also say she is okay."
In an interview with Spanish newspaper Marca, Fuentes said she jumped into the water "because I saw that no one, no lifeguard, was diving in."
"I got a little scared because she wasn’t breathing, but now she’s fine," she said
“Watching yesterday’s medical emergency of 2x Olympian Anita Alvarez and subsequent rescue by coach Andrea Fuentes was heartbreaking for our community," USA Artistic Swimming told The Associated Press in a statement.
"She gave an exceptional solo performance and competed brilliantly in four preliminary and three final competitions across six days," it said.
Alvarez finished seventh in the Wednesday individual final.
She is expected to take a day of rest on Thursday and will decide with a doctor whether she can swim in the upcoming free team finals, Fuentes said.