This is the moment the NYPD’s Aviation Unit came to the rescue of an elderly man who had fallen ill aboard an “Anthem of the Seas” cruise ship.

The ship was leaving New York — moving through the Ambrose Channel — at 5:50 p.m. Friday when the man suffered a cardiac episode and the ship’s captain and medical staff determined that he urgently needed medical attention, cops said.

The ship changed its course and headed toward the Coney Island area. There, an arriving Aviation Unit Quick Reaction Force aircraft — with four team members aboard — lowered a tactical medic onto the vessel.

First responders then secured the man and hoisted him onto the plane. He was taken to Staten Island University Hospital North, where he is recovering and expected to survive.