Dressed in a black Batman costume, his fists clenched as he took on foe after foe around San Francisco, a 5-year-old boy who has battled leukemia for years fulfilled his wish Friday to be his favorite superhero.

In the process, Miles Scott became a darling of social media and attracted thousands of fans around the country, even at the White House.

“When you have an illness, it’s very important to know you have a support system,” said Gina Futrell, 51, who was among a large crowd gathered at Union Square for a chance to see the Batkid during his day of capers. Futrell has multiple sclerosis. “I have an extremely strong support system, and I hope he does, too. He’s such a little hero.”

Batkid was called into service by San Francisco Police Chief Greg Suhr to help fight crime. He rescued a woman from cable car tracks in Nob Hill and captured the Riddler in the act of robbing a downtown bank. He even rescued the San Francisco Giants mascot — Lou Seal — who was kidnapped by the Penguin.

Miles, who is now in remission, was able to fulfill his wish through the Make-A-Wish Foundation and the city.

Batkid had a police escort worthy of a dignitary as he sped around the city in a black Lamborghini with a Batman decal, while officers blocked traffic and rode along with him on motorcycles. The White House sent out a Tweet encouraging Batkid to “Go get ‘em!”

The crowds grew after each stop, reaching into the thousands by the time he got to Union Square for lunch at the Burger Bar atop Macy’s. Spectators climbed trees and lampposts, and police and organizers struggled to keep a path open for the motorcade, which sped past onlookers lining the streets six deep for several blocks.

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 “Batkid, Batkid.”

“How amazing is this kid?” asked Lisa Aguirre, 31, who also awaited Miles in Union Square. “He picked my favorite superhero — Batman. I came down to show my support.”

From Union Square, Batkid headed off in the Lamborghini to rescue a damsel in distress on a cable car track. Hundreds of people jostled for space, as Batkid and an adult Batman impersonator emerged from the sleek black car.

The damsel sat on the street with 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 for another crime — the diabolical kidnapping of Lou Seal by the Penguin. A grateful Mayor Ed Lee gave Miles 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.

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.

The San Francisco Chronicle

distributed hundreds of copies of special-edition newspapers with the headline, “Batkid Saves City,” in Union Square.

“This has turned into a full blown phenomenon,” the police chief said.