The worst of the storm started about 5 p.m., as a warm front from the south approached New York City. A line of thunderstorms moved through, intensifying as they reached the shore, causing winds to rotate within a small area, a characteristic that prompts a tornado warning, according to John Murray, a National Weather Service meteorologist. The storm tore through Staten Island, then Brooklyn, hitting Park Slope and Bedford-Stuyvesant hard. It then moved into Queens, striking strongly at Middle Village, Forest Hills and Bayside.

Just before 8 p.m., Consolidated Edison reported that more than 25,000 customers were without power in Queens, and more than 5,000 customers on Staten Island experienced power failures. Partial building collapses were reported in at least two locations in Queens  on Roosevelt Avenue and on Yellowstone Boulevard  and at least two in Brooklyn, on Hamilton and Fourth Avenues.

Bus and car traffic was reported at a standstill through much of the hardest-hit areas.

Mayor Michael R. Bloomberg surveyed storm damage at 111th Street and 52nd Avenue in Corona, Queens, before a planned event at Flushing Meadows-Corona Park. He said that most people should have power restored by morning and that while there might have been some damage to school buildings, he expected all schools to be open on Friday.

“While it may be an act of God, it doesn’t make it any easier for us,” Mr. Bloomberg said. “The good news is that most people were safe, just annoyed  traffic being bad, or a tree coming down in their yard.”

Fallen trees disrupted Long Island Rail Road service in and out of the city, forcing officials to close down service from Pennsylvania Station on the L.I.R.R. because of overcrowding there. Commuters whose trains home were canceled flooded into the subway seeking other routes to Queens.

Sal Arena, a Metropolitan Transportation Authority spokesman, said that test trains on the tracks between Penn Station and the Jamaica station had encountered more debris than anticipated, and L.I.R.R. service from Penn Station remained suspended at 11:30 p.m. There was limited service from Jamaica and the Atlantic Avenue terminal in Brooklyn to points east.

L.I.R.R. officials anticipated restoring service into and out of Penn Station for the Friday morning rush, though they expected delays. Service was not expected to be restored on the Port Washington branch until later.