A boiler ignited the basement floor of the 98th Street and Broadway shop about 7:55 a.m., according to deputy battalion chief Roger Sakowich.
Greg Mims, who lives upstairs from the bagel store, was readying his kids for school when a neighbor alerted him to the fire, he said.
The hallways were filling with smoke as they dashed out of the apartment building, Mims said.
About 60 firefighters responded to the scene and brought the fire under control about 9:20 a.m., the FDNY said.
The damage was contained to the bagel shop, the FDNY said.
No injuries were immediately reported, a fire spokeswoman said.