He was trying out a 45m (150ft) high zip wire at Victoria Park, where the Games are being shown on big screens.
The wire then lost momentum, leaving him suspended "like an odd Christmas decoration" above a crowd of people.
As onlookers snapped photos, he joked: "This is great fun but it needs to go faster."
Highwire act Boris defies political gravity
Lee Medcalf, who was at the event, said: "When Boris came down the zip wire, it was very James Bond-esque with him shouting 'Team GB'.
"However, he seemed to lose momentum and was left hanging there like an odd Christmas decoration for about five to 10 minutes.
"He spoke to the crowd, which had gathered beneath him, saying 'this is what it's all about; this is great, this is fantastic, this is Team GB'.
"I was thinking 'Yeah it's good, but you're still just hanging there'."
A spokesman for the mayor said: "The mayor has survived his first zip wire experience relatively unscathed.
"Clearly the judges are likely to have marked the mayor down for artistic impression, and unlike team GB, the mayor may not be winning too many Gold medals today.
"He does however remain unbowed."
Prime Minister David Cameron said London was "lucky to have" Boris Johnson as mayor.
Mr Cameron said: "If any other politician got stuck on a zip wire it would be disastrous.
"With Boris it's a triumph... London is lucky to have him."
The Mayor of London Boris Johnson was left dangling on a zip wire for several minutes when it stopped working at an Olympic live screen event.