A team of cops and firefighters rescued an inspector perilously dangling from a car on the Roosevelt Island Tramway for nearly 90 minutes with his leg caught in the machinery.

Police raced to the unidentified inspector’s rescue in another tram as he hung some 250 feet in the air at around noon.

They loaded the 49-year-old inspector, who was making his daily rounds when he got snagged, into a rescue basket and lowered him into the second tram.

“I’m glad we put in our time practicing, because this is the first time we’ve had to do a real rescue with one of these workers up there,” said NYPD Detective Russel Thatcher.

Other than a scare of a lifetime, Cops said the inspector suffered injuries to his right leg.The Roosevelt Island Operating Corp. said the worker was making routine inspections when his foot became jammed between two wheels.