A pilot fainted mid-air while flying to Madeira. Pexels

This is not a Hollywood movie script. It really happened - a pilot fainted mid-air while chartering a mid-air flight.

Luckily, there was an off duty pilot on board the flight from Manchester to Madeira who was able to safely land the plane.

A passenger on board the flight Nicholas Banks told the Daily Mail: "They made the announcement that there had been an incident on the flight deck and another Jet2 pilot who happened to be on holiday came forward from the back of the plane."

Banks added: "He (the off-duty pilot) offered up his services to the crew and went into the cabin. He didn't come out until he helped the first officer land the plane."

Another passenger, Tracey Jayne told the media outlet: "All crew stopped serving and there was a bit of moment when passengers realised something was amiss. I saw a member of the crew speak directly to a passenger and he vacated his seat and went to the cockpit."

Media reports are that the runway at Porto was closed for half an hour for the emergency landing.

The 40-year-old pilot had to be rushed to hospital immediately when the Boeing 757 landed.

The airline did release statement after the emergency landing.

It reads: "The Flight LS765 from Manchester to Funchal diverted to Porto as a precautionary measure this morning, due to one of the pilots feeling unwell. A standby aircraft and replacement crew will be flown to Porto so that we can get customers on their way to Funchal as soon as possible."