Jay-Z is planning a surprise concert atop the marquee of the Ed Sullivan Theater next month that will turn rush-hour Times Square into a gigantic street party, sources told The Post yesterday.

The rapper is close to obtaining the necessary approvals for a July 8 “Late Show With David Letterman” performance, the sources said.

The city killed the same plan in the summer of 2010 over concerns about crowd control and security.

“If he gets permission from the mayor’s office, it’s going to be off the hook,” a law-enforcement source said. “They’ll have to shut down Broadway around the Letterman building. They’ll have to have a strong police presence. It’s going to be chaos with so many fans.”

The sources said the concert will likely go off as planned, despite the Bloomberg administration’s decision to pull the plug three years ago.

“It is close. There are a lot of logistical concerns,” one said, including shutting down a large swath of Times Square near the theater, which is between West 53rd and West 54th streets.

But, the source added, “This would be a great event for New York City.”

In 2010, Jay-Z and Eminem moved their concert to the theater’s rooftop, where permits weren’t required, after the city put the kibosh on their initial plan.