The “I Will Survive” singer almost didn’t make it.

Gloria Gaynor told People magazine Thursday she is finally liberated from the chronic pain that gripped her spine for decades after enduring a risky two-part surgery in 2018.

“I thought I was going to die,” the singer admitted about landing in the ICU after the first part of her procedure in January of last year.

FORMER STUDIO 54 OWNER TELLS ALL

According to the outlet, the 75-year-old’s life was in the hands of Dr. Hooman M. Melamed, a board-certified spine surgeon in Los Angeles.

“I had to perform one of the most difficult surgeries [involving] breaking her spine then reconstructing it,” Dr. Melamed told the magazine. “The procedure is [rare] because it is so complex and requires a great deal of precision.”

The disco icon’s health battle began more than 40 years ago, in 1978, when she was performing “tug-of-war” choreography with her dancers at New York City’s Beacon Theatre. It was there where Gaynor fell over a monitor on stage.

“The next morning, I woke up paralyzed from the waist down,” Gaynor recalled. “I called my boyfriend and said, ‘Please come — I can’t move my legs.'"

STUDIO 54 SECRETS REVEALED

Gaynor joked, “First I was afraid. I was petrified,” quoting the lyrics from her most popular hit song.

But Gaynor’s real-life nightmare was no laughing matter. Over the next four decades, Gaynor was in and out of operating rooms in an attempt to heal the “domino effect” of issues that came after the accident.

In 1978, Gaynor had surgery to remove a ruptured disc and fuse two of the vertebrae in her lower spine. This procedure helped her walk again. Still, Gaynor claimed employees at her record label declared “the queen is dead.” Determined to make a comeback that year, Gaynor recorded “I Will Survive” while wearing a back brace.

“I’ve always believed that God said to the writers, ‘Sit down, write this song and just hold onto it. I’m going to send you somebody,’” she said. “And he sent me.”

The song quickly topped charts across the globe and led to nine albums in the next 15 years. But Gaynor’s private ordeal was far from over. In 1997, she went under the knife again to correct the spinal stenosis caused by the first surgery. Doctors inserted two rods just to stabilized the area.

Disco singer Gloria Gaynor performs a song on Dec. 13, 1975, in Hollywood, Calif. (Photo by Michael Ochs Archives/Getty Images)

Disco singer Gloria Gaynor performs a song on Dec. 13, 1975, in Hollywood, Calif. (Photo by Michael Ochs Archives/Getty Images)

THREE DOG NIGHT SINGER: 'I LOVED GETTING HIGH'

“But it made my back flat, which made me lean forward,” said Gaynor. “There were times when I had to sleep in a chair because I just couldn’t sleep lying down.”

Gaynor had to manage her chronic pain with periodic epidurals, along with prescribed pain and anti-inflammatory medications through the years.

But Gaynor knew she still needed help. She described how the pain became unbearable during a shopping trip in New York City during the fall of 2017, when she struggled to make it a few doors down to a restaurant.

“By the time I got there, I was in excruciating pain,” said Gaynor. “I couldn’t have taken another step. [I thought], ‘This is it. I can’t live like this.’”

Gloria Gaynor endured a private health battle over the years.

Gloria Gaynor endured a private health battle over the years. (Debra L Rothenberg/Getty Images)

It was then when Gaynor confided in Dr. Melamed.

THE ZOMBIES SINGER TELLS ALL

“He said, ‘You need a lot more than what they’ve been doing for you — it’s going to be extensive,’” said Gaynor.

Gaynor soon found herself in the operating room again.

“He told us that I took five years off his life because they really thought they might lose me,” said Gaynor about the first part of the surgery.

Her high vitals did cause alarm, but Dr. Melamed was able to move forward with the second part of the surgery five days later. The magazine shared it took just one day after that procedure for Gaynor to realize it was all worth it.

“I was walking bent over for 20 years,” said Gaynor, who initially believed that paralysis was her fate. “Right after the surgery when they got me up and I was walking straight for the first time… it was incredible… I thought, ‘I’ve seen people perform in wheelchairs, I could do that.’”

'LEAVE IT TO BEAVER' STAR TELLS ALL

Today, Gaynor says she’s “absolutely pain-free” and regularly practices Pilates with an instructor. She also plans on dancing in heels while on tour this summer.

“I [recently] went to a wedding and actually danced,” said Gaynor. “People were on the floor trying to copy my moves.”

Looking back, Gaynor credited faith for giving her a sense of hope that she would finally heal.

“I prayed that God would use the doctor’s hands as His hands, and I have no doubt that he did,” she said.