MIDTOWN — A demolition worker trapped during a building collapse that killed his coworker was freed by rescuers after being pinned under concrete slabs for more than three hours, the FDNY said.

Both men, who worked for Northeast Interiors Specialist, were on the first floor of 25 W. 38th St., near Fifth Avenue, when the rear section of the building crumbled into a V shape at 10:28 a.m., officials said.

First responders were able to reach the dead worker immediately and remove his body from the scene, but the surviving worker, Kairo Garcia, 29, was partially buried underneath the rubble in the building's basement.

"The person was trapped at the very point of that V," FDNY Commissioner Daniel Nigro said during a press conference after the rescue. "The [collapsed] building, of course, is a very dangerous place to work."

Rescuers were faced with the difficult task of freeing Garcia in the unstable structure without further jeopardizing its stability and causing it to fall on top of him, officials said.

"I don't want to die. I don't want to die," Garcia told his brother who also works at the site, according to David Gomez, Garcia's half-brother.

"He was cooperating. He wasn't panicking. He was very appreciative of the overwhelming effort to get him out of there," said EMS Haz-Tac Jonathan Negron. "Our ability to access from the waist down was very difficult."

Rescue workers tried to comfort the Nicaraguan immigrant as medics administered intravenous medicine and assessed his injuries, knowing at any time the whole structure could collapse on all of them.

"It was a very long and prolonged operation," FDNY Captain Dominic Bertucci said. "It was very technical. We had minimal lifting points to try to lift debris off the member. We had to bring a lot of specialized tools and what we needed to worry about was if we lifted our one point, we didn't want our debris to shift on another point, where it was located on the victim."

Garcia was bleeding from the head and suffered serious injuries to his lower extremities, according to officials and relatives. He was taken to Bellevue Hospital, where he was listed in stable condition.

The name of the worker who was killed has not yet been released.

One patient still trapped, #FDNY medics treating him. Firefighters working to remove patient from debris. A photo posted by FDNY (@fdny) on Oct 30, 2015 at 10:07am PDT

Witness described a frantic scene just after the construction accident.

"I saw three workers, guys running up the block toward the construction site, then I stepped out and saw some dust coming out from the open construction site," said Joseph Maldonado, 63, a security guard at 48 W. 38th St. "When I saw the police dogs I knew someone got hurt seriously. I was worried."

Northeast did not have any immediate information available.The building, which was once the home of the Havana NY restaurant, filed for a full demolition permit last year and had the permit issued for work on Oct. 16, according to Department of Building records.

It is being torn down to make way for the 175-room boutique Aloft New York Midtown Hotel, by Starwood Hotels, which planned to open in the fall of 2016.

The hotel's developer, Morris Moinian's Fortuna Realty Group, bought the building in 2012 and sued Havana NY last year to try to get them out.

DOB workers were responding to the scene, a spokesman said.

Murray Weiss, Nick Rizzi, Sybile Penhirin, Janon Fisher and Trevor Kapp contributed to this report.