A penthouse-topped Upper West Side brownstone was enveloped in flames Thursday night as 170 firefighters fought to contain the flames in the stately six story building at 23 W. 76th St.

The first of four alarms was sounded at 6:13 p.m. By 8:30 p.m. the fire was upgraded to four alarms and 39 FDNY units were on the scene.

One firefighter was being treated on site with minor injuries last night.