The firefighters were rescued and taken to the hospital, Assistant New York City Fire Chief Joseph Jardin said.
At least one firefighter was being treated for burns, Jardin said. None of the injuries were considered life-threatening, he said.
Another firefighter involved in the fire response sustained minor injuries, Jardin said.
The fire started around 2:20 a.m. in a one-story building in a strip of stores, salons and restaurants on Springfield Avenue in Jamaica. It was placed under control around 5:30 a.m.
The cause is under investigation.
The trapped firefighters had stretched a hose to the back of the building and were working about 10 feet inside the structure when a portion of the roof collapsed, Jardin said.
"Initially, there was a mayday transmission that occurred alerting our members on the scene that we did have a member or members in distress," Jardin said.
A search team found the firefighters under a 20-foot by 20-foot section of heavy roof and quickly pulled them to safety, with fire burning close by, Jardin said.
Get breaking news alerts in the FOX 5 NY News app. Download for FREE!