A wild all-night party in Harlem turned gruesome Monday, when a man who was asked to leave plunged from a window and got impaled through the groin on a spiked fence, police and witnesses said.

The situation escalated further when two revelers argued over how to help — and one bashed the other so hard with a beer bottle it spattered blood all over the kitchen floor.

“We were all drinking. We were all talking here. Just hanging out,” Celso Guzman Rios, 31, said about his skewered pal Eliseo Alvarado-Gonzalez, 27.

“Me and another guy went out to buy beer and we saw him hanging on the fence. . . When I saw him on the fence, I said, ‘Holy f-cking sh-t!’ ”

The incident began shortly before sunrise, as Rios, Alvarado-Gonzalez and three others held the night-long rager at an apartment on West 135th Street near Riverside Drive.

At one point, Alvarado-Gonzalez was asked to leave because he was making too much noise, cops and witnesses said.

But instead of just taking the stairs, the man “jumped” out the window, Rios said.

“He didn’t want to leave. My friend said, ‘Leave or I’m going to call the police.’ But he wouldn’t leave. Then I lost sight of him,” Rios said.

Rios had no clue his trouble-making party pal had plunged more than 12 feet — and landed on an 8-foot-tall wrought-iron fence — until he returned from the beer run around 7 a.m., he said.

Alvarado-Gonzalez had become impaled on the spiked fence through the right side of his groin — and a pool of blood formed on the pavement below.

“I lifted him up. He didn’t scream or anything. He must have been numb. He must have been too drunk to feel anything,” Rios said. “There was a lot of blood flowing from his leg.”

Inside the apartment, a fight then broke out between two of the partygoers over whose friend Alvarado-Gonzalez was — and thus whose responsibility.

“He’s you’re friend, why don’t you help him!?” one of the drunken men shouted, according to Rios.

A furious Jamie Mendez, 28, allegedly smashed a Corona bottle over the man’s head, police and witnesses said.

“I thought he was going to kill him,” Rios said of the brawl. Mendez was later arrested on second- degree assault charges and hauled away in handcuffs.

Emergency responders had to cut out a 4-foot section of the fence to pull Alvarado-Gonzalez from it.

“I held him up until the police came,” Rios said. “The police arrived and started cutting the fence to free him.”

Alvarado-Gonzalez was rushed to Mount Sinai St. Luke’s hospital, where he underwent surgery and was placed in a medically induced coma, a police source said.

He was in critical condition on Monday night and expected to be taken out of the coma on Tuesday, the source said.

Police were investigating whether any criminality was involved on Monday night.

Though Rios initially said Alvarado-Gonzalez jumped, he backpedaled later, saying, “I really don’t know what happened — if he jumped or someone pushed him.”

But a neighbor, Eladia Oriach, 69, who lives on the first floor, said she didn’t hear anything suspicious.

“The victim lives with several other young men in 2B. I only heard a loud sound. It was a strong sound, but I did not hear any screams,” she said.

Additional reporting by Natalie O’Neil