Emergency services have freed a distressed child whose arm was stuck in a vending machine for almost six hours.

The four-year-old boy's arm became trapped in the vending machine at a Lonsdale Street hotel complex shortly after midday on Sunday.

His hand was stuck behind flaps in the vending machine that work as anti-theft mechanisms.

Father Aaron Shorthouse said his young son, Leo, had been eyeing off a packet of Oreo biscuits.