The 5-year-old at times seemed overwhelmed by the outpouring, quietly working through each scenario with clenched fists and tight lips amid delirious chants of "bat kid, bat kid."
"How amazing is this kid," said Lisa Aguirre, 31, who also awaited Miles in Union Square. "He picked my favorite superhero — Batman. I came down to show my support."
Hundreds of people jostled for space for Batkid's first mission, in the city's Russian Hill neighborhood. A woman sat on the cable car tracks in a dress and thigh-high black boots. She had a handkerchief around her mouth, and her hands were bound behind her back. Batman and Batkid sprang into action, with the aid of a trampoline, as the crowd roared.
They rescued the woman and disabled a plastic replica bomb she was tied to.
The two masked superheroes then took off to nab the Riddler as he robbed a downtown bank.
Batkid later headed off to the kidnapping of Lou Seal by the Penguin. A grateful Mayor Ed Lee gave the boy a key to the city after the crooks were corralled.
Miles, who lives in Tulelake in far Northern California, didn't know what was in store for him and thought he was in San Francisco just to get a Batman costume so he could dress like his favorite superhero, KGO-TV reported.
He was diagnosed with leukemia when he was 18 months old and ended treatments in June.
His father, Nick Scott, thanked the Greater Bay Area Make-A-Wish Foundation and the estimated 7,000 people who helped make his son's wish come true.
"All the doctors, nurses and all the other parents that have to deal with the same thing we're going through. I hope they get a conclusion to their illnesses like we're getting," Nick Scott told KGO-TV.