Electricity was restored to thousands of customers in New York City on Saturday evening after an outage that knocked out traffic lights, stalled elevators and limited subway service.

Just before midnight, Con Edison CEO John McAvoy said in a news conference that all 73,000 customers affected by the outage in Midtown Manhattan and the Upper West Side had power restored. At its peak, the outage affected an area from 71st Street south to 42nd Street and east from the West Side Highway to Fifth Avenue.

New York Gov. Andrew Cuomo added that although service was restored some traffic lights remained out and New Yorkers should stay indoors for their safety.

"We would not encourage New Yorkers to go out if you don’t have to go out," he added, calling the situation potential "pandemonium."

“This could have been much worse," he said, commending first responders and New Yorkers. “When things are at their worst New Yorkers are at their best.”

"While fortunately, no injuries occurred as a result of this incident, the fact that it happened at all is unacceptable," Cuomo said in a statement earlier. "I am directing the Department of Public Service to investigate and identify the exact cause of the outages to help prevent an incident of this magnitude from happening again. Until the recovery is complete, we will continue to take all necessary actions to ensure the safety and security of New Yorkers."

“The system has to be better than that. Period,” he said.

The state-run Metropolitan Transportation Authority (MTA) tweeted Saturday evening that signals on the A, B, C, D, E, F, and M subway lines were affected and four stations were temporarily closed to the public due to lack of power: 59th St.-Columbus Circle, 47-50th Sts.-Rockefeller Ctr., 34th St.-Hudson Yards, and Fifth Ave./53rd St. It was not immediately clear when full service would be restored.

"Our entire system is affected by the Con Edison outage," the agency tweeted shortly after 9 p.m. "In Manhattan, the bus is your best bet."

New York City Council Speaker Corey Johnson tweeted that Con Edison had reported a "major disturbance" at a substation on West 49th Street. The New York City Fire Department said the fire started at West 64th Street and West End Avenue but did not say if that was the source of the outage.

ConEd spokesman Sidney Alvarez told Fox News that the utility experienced an "equipment failure at one of its substations, but wasn't sure of the specific location. Cuomo said the outage started at 6:47 p.m.

Straphangers tweeted photos of blacked-out train stations and non-working traffic lights.

Social media was full of reports of ordinary citizens directing traffic at some Midtown intersections. Police officers were directing traffic at other major thoroughfares. The Fire Department of New York said it received reports of people stuck in elevators on the Upper West Side and subway passengers stuck on trains

The temperature was warm, above 80 even as the sun set, but not as steaming as Manhattan can get in July. Con Ed CEO McAvoy said the blackout was not caused by "excessive load," as could have been the case on a warmer day.

Mayor Bill de Blasio, commenting from a presidential campaign visit to Iowa, initially said the city's emergency management agency was working with police and fire personnel to respond to affected areas.

In a later statement, De Blasio said police had "confirmed that there's no foul play. This was a mechanical issue." A spokesperson for de Blasio tweeted late Saturday that the mayor was returning to New York City.

Ginger Tidwell, a dance teacher and Upper West Side resident, was about to order at the West Side Diner at Broadway and West 69th Street just before 7 p.m.

"When the lights started flickering, and then were out," she said, "we got up and left, walking up Broadway with all the traffic lights out and businesses dark."

Once they got to 72nd Street, they found another restaurant open with power.

"It was still sunny and everyone just came out to the street because they lost power and air conditioning; it was super-crowded," she said. "Everyone was hanging out on the street on a nice night. All you could hear was fire trucks up and down Broadway. All of Broadway was without traffic lights."

Multiple Broadway shows like "Frozen" were canceled as some theaters lost power, forcing thousands to exit darkened theaters into crowded streets, according to Playbill. Castmembers from "Come From Away" and "Hadestown" put on an impromptu performance outside a venue, according to social media posts.

Emily Totero's plans to take out-of-town guests to see "Moulin Rouge" were ruined when they arrived to find the theater district without power.

"You could see all the theater lights across the street, all the marquees went out. That's what we noticed first," she said.

CLICK HERE TO GET THE FOX NEWS APP

Much of Rockefeller Center was also without power, though some buildings did have lights on.

An evacuation was ordered at Madison Square Garden, where thousands of people had gathered for a concert by pop singer Jennifer Lopez.

Saturday marked the 42nd anniversary of the 1977 blackout, which affected much of the city for 48 hours and resulted in widespread looting, arson and other criminal activities.

Fox News correspondent Bryan Llenas and the Associated Press contributed to this report.