Belt fouled off 16 two-strike pitches before lining out to Angels right fielder Kole Calhoun. The at-bat lasted 12 minutes and 45 seconds. It was the most pitches in an at-bat since records began in 1988.
"I wasn't going to give it up and the pitcher wasn't either,'' Belt said. "It made for a good battle. If it helped get me a little bit locked in for later in the game, it was worth it.''
Barria threw 49 pitches in all in the first inning as the Giants loaded the bases, but he escaped without allowing a run. In contrast, Giants starting pitcher Johnny Cueto retired the Angels in the first inning on just 19 pitches.
At one point during the at-bat, Belt chatted with catcher Martin Maldonado.
"He actually said that he hates when someone else does that. Belt said that," Maldonado said.
"If I'm in the field and somebody does it, I can't stand it, but I wasn't going to give in,'' Belt said. "I basically had to apologize to everybody after that.''
It took nine pitches for Belt to work the count full, as he fouled off five pitches in the process. He swung and missed just once and was greeted with high-fives when he returned to the dugout.
"I think after like the 16th pitch the crowd started getting into it,'' said Angels star Mike Trout, whose two-run homer in the eighth was his big league-leading ninth and his third in as many games. "I couldn't imagine being up there for 21 pitches. It's unbelievable.''
Angels shortstop Andrelton Simmons offered his take.
"That was impressive, huh? I was really tired after that," Simmons said. "Regardless of the end result, that was fun to watch. Don't want to do it again.''
Belt saw eight pitches in his second at-bat against Barria in the third inning, this time singling as the Giants loaded the bases again, this time with no outs. Barria was then removed from the game after he had thrown 77 pitches.
"Even the second at-bat, he did the same thing. Like, this can't be happening,'' Maldonado said.
Barria was charged with two earned runs, as reliever Noe Ramirez allowed two of the runners to score.
The Giants won 4-2.
ESPN Stats & Information and The Associated Press contributed to this report.