WATCH: Amazing Rescue of Yosemite Hiker Who Plunged Into Rapids
PHOTO: Video shows a helicopter team rescuing a stranded backpacker from the rapids at Yosemite National Park.

A backpacker narrowly escaped death after slipping into the rapids at a Yosemite National Park waterfall, park officials said.

The hiker managed to pull himself from the torrents onto a boulder, where he waited until a helicopter crew arrived to help. The amazing rescue was caught on video recently released by the California park.

Mom Directs Teen's Alaskan Rescue From 2,250 Miles Away

Teen Rescued From Peak Says He's Stupid But Lucky

A ranger was lowered on a line down toward the rushing water, and video shows the ranger and the unnamed backpacker being hoisted back up toward the hovering helicopter. The man, who was treated for hypothermia, would have tumbled over the waterfall and died if he hadn't found the boulder, park officials said.

The accident happened on May 28 in an area of the park called the Inner Gorge.

The Associated Press contributed to this report.

More ABC News