Onlookers were terrified as a Royal Australian Air Force (RAAF) plane flew within metres of high-rise buildings in Brisbane during a festival.

The stunt involving a Boeing C-17 has been slammed on social media as "unnecessarily stupid and dangerous".

Footage surfaced online showing the aircraft flying through the city within mere metres of buildings that the plane only narrowly avoided.

Some people referred to the stunt as "9/11 stuff".

Advertisement

"All it would take is a small mistake and those buildings and people would be toast," one person commented.

"I mean it's cool and stuff, but that could've gone very, very, VERY wrong," someone else said.

"Why would they even think that's okay flying towards buildings like that where people live?" another commenter chimed in.

Other social media users have praised the skills of the RAAF pilots involved in the stunt.

"Unless both pilots had a synchronised heart attack or catastrophic plane failure, nobody was in any danger," one said.

The stunt was part of Riverfire, a festival that happens every September in Brisbane and celebrates the end of the city's three weeks-long arts and cultural festival.