SAN FRANCISCO — The crowd gathered to watch the San Francisco Giants in Game 7 of the World Series went silent at the end of the ninth inning as the ball popped foul by Kansas City Royals’ catcher Salvador Perez hung in the air above Giants third baseman Pablo Sandoval. Then cheers erupted, sounding off across the city when the ball smacked inside Sandoval’s glove to clinch a narrow 3-2 defeat.The victory did not come any more easily for the fans than it did for the team. But celebrations continued well into the night, with police — several in riot gear — keeping a watchful eye as thousands paraded down Market and Mission streets in San Francisco. Some rowdier fans set fires or jumped on top of Muni buses, prompting the agency to shut down service on city streets. Other fans spray-painted walls, and one man was shot in the arm during the celebrations, according to police. The wound was not considered life-threatening.The celebrations started out much tamer for fans who were still reeling from the close win. Thousands gathered to watch the game at the city’s Civic Center, carrying flags in a sea of orange and black at San Francisco’s biggest baseball party. City Hall was a lit in a striking orange.”I was so stressed out knowing that last out was still there,” said San Francisco resident Diana Cholden. “We brought it home, but they know how to torture us.”San Francisco native Valerie Blueford, a 36-year fan, held a sign over her head that said, “Yes, Yes, Yes” as she jumped up and down after the final out.”I grew up at Candlestick Park, and now I get to see (the Giants) win three World Series championships in my lifetime,” she said as she beamed. “It means a lot to me.”Wednesday’s atmosphere was a stark contrast to the night before, when silence fell over the outdoor gathering spot as the Royals coasted to a 10-0 victory. On Wednesday, fans showed no signs of leaving or quieting as it came down to the wire, and after the win was secured, police kept a steady watch on revelers. Within minutes of the game ending, a crowd blocked King Street outside the stadium, chanting “Dynasty! Dynasty!” as smoke from fireworks lingered overhead. Scores of police, some in plain clothes, began separating crowds as thousands poured from restaurants, bars and parties to celebrate the Giants’ third World Series win in five seasons. Bonfires popped up in the middle of the road along Mission Street, and people climbed on top of street lights and even a Muni bus along Market Street. Some set off fireworks dangerously close to crowds near ATT Park. The energy was abundant long before the collective sigh of relief upon Sandoval’s catch to end the Series.In the third inning, with the game tied 2-2, Mission District resident Luis Portillo fed off the excitement of the crowd. “We still have that hope,” the 20-year-old said. “Whatever happens, happens.””These are true fans,” said Brickhouse Cafe Saloon doorman Will Lynch. “They come here from different parts of city to be near the ballpark.”Lynch said he expected celebrations to be just as raucus as those that came after the team’s 2010 and 2012 World Series wins. But he thought it would be more “controlled” this time around.”I think some fans were embarrassed by things in the past,” Lynch said of the burning of a city bus in 2012.Tenderloin resident Stu Barnes, 33, said the coming together of people from all over the Bay Area was reflective of the City by the Bay being a “baseball city.””Take a look around you,” he said while watching the game in black-and-orange pinstripe pants from Hemlock Tavern on Polk Street. “There are weirdos in here that can tell you the E.R.A. of a bullpen pitcher. It’s beautiful.” Follow David DeBolt at Twitter.com/daviddebolt. Follow Katie Nelson at Twitter.com/katienelson210. Follow Thomas Peele at Twitter.com/thomas_peele.