A pilot trying to land his single-engine plane at a New Jersey airport on Tuesday missed the runway and wound up stuck in a tree for four hours, authorities said.

The 33-year-old pilot was trying to touch down at the Central Jersey Regional Airport in Hillsborough around 12:15 p.m. when the engine of his Cessna 172K suddenly died.

He spent four hours inside the aircraft, nestled in treetops about 70 feet above the ground.

Rescuers were finally able to free him around 4 p.m., lowering him to the ground with the help of a plastic gardening bucket.

The pilot was the only person aboard. No one on the ground was injured.

He was taken to a hospital for assessment, but didn’t have any serious injuries, officials said.

The Federal Aviation Administration and National Transportation Safety Board are investigating.

With Post wires