A Cathay Pacific flight from Australia to Hong Kong has been diverted to Indonesia due to an engine fault that a passenger says sent flame streaming from a wing and caused panic on board.

The Hong Kong-based airline said in a statement the Airbus A330 departed the west coast city of Perth on Thursday carrying 254 passengers and was diverted to Bali due to an "engine defect."

The engine was shut down and emergency landing was declared. Fire services met Flight CX170, which landed safely on Friday. No one was injured.

Passenger Joel Sirna told Perth Radio 6PR he heard a loud bang then saw sparks and flames streaming from an engine.

Cathay Pacific says "what witnesses saw was a light due to the engine failure, not a real fire."