The 25-year-old lost consciousness after completing her solo free final routine in Budapest on Wednesday.
Alvarez’s coach Andrea Fuentes responded to the drama by diving in fully clothed to pull the swimmer to safety.
“It was a big scare,” four-time Olympic medallist Fuentes was reported as saying by Spanish newspaper Marca.
“I was scared because I saw she was not breathing, but now she is doing very well.
“She only had water in her lungs, once she started breathing again everything was OK.”
And speaking to Spanish radio, she said: “It felt like a whole hour. I said things weren’t right, I was shouting at the lifeguards to get into the water, but they didn’t catch what I said or they didn’t understand.
“She wasn’t breathing. I went as quickly as I could, as if it were an Olympic final.”
Alvarez was given medical attention poolside before being taken away on a stretcher.
In a statement on the US Artistic Swimming Instagram page, Fuentes said Alvarez would be assessed by doctors on Thursday before a decision was made on her competing in Friday’s team event.
Fuentes said: “Anita is OK – the doctors checked all vitals and everything is normal: heart rate, oxygen, sugar levels, blood pressure, etc… all is OK.
She wasn't breathing. I went as quickly as I could, as if it were an Olympic final
Anita Alvarez's coach Andrea Fuentes
“We sometimes forget that this happens in other high-endurance sports.
“Marathon, cycling, cross country… 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.
“Anita feels good now and the doctors also say she is OK.
“Tomorrow she will rest all day and will decide with the doctor if she can swim free team finals or not. Thank you for all of your well wishes for Anita.”
Alvarez, who finished seventh in the final, previously fainted following a routine during an Olympic qualifier in Barcelona last year.
Fuentes also rescued her on that occasion.