A still frame from the video shows the moment a whale breached the water off the coast of Australia. International Business Times

A group of tourists in Australia had a close encounter with a massive humpback whale — and luckily emerged alive. Mark Collins, of Dunsborough, was on vacation with his family when he captured on video a whale leaping out of the ocean into the air, narrowly missing a group of people in a tiny dinghy.

Collins, 49, said he was out on his boat with his family and some friends earlier in July when he saw three whales swimming around a few dinghies filled with tourists. He was recording video when one of the whales flew out of the water and flopped back down next to the little boats.

Read: Video Shows Elephant Being Rescued From Drowning In Ocean

“You could hear the screams in the background,” he told Australian news outlet WAToday. “It was quite a spectacle, but it could have been a disaster.”

A still frame from the video shows the humpback whale emerging from the water. International Business Times

Breaching whales are a common sight in the area, Collins said. And it turns out, according to scientists, the whales might use breaching as a means of communication with each other. A team of researchers studied a group of humpback whales off the coast of Australia and found that the whales were more likely to breach when they were farther apart from each other.

They could be using the breaching as a way to “slap” the water and make sound in order to better communicate with each other, the researchers said in a study published in the journal Marine Mammal Science.

Read: Watch Sharks Surprise Tourists In Shallow Water At Florida Beach

“This makes absolute perfect sense,” Chris Parsons, a cetacean biologist at George Mason University in Virginia told Hakai Magazine in February. “Even though these whales can produce calls that travel great distances, if there’s a lot of noise, it might be easy to drown out. Leaping up in the air and splashing down is equivalent to the really keen kid a classroom jumping up and down waving his arms.”