In the San Fernando Valley during the summer of 1962, protagonist Scott "Scotty" Smalls moves to a new town with his mother and stepfather Bill and attempts to join a neighborhood baseball team who plays in a local sandlot. With the help of team captain Benjamin Franklin Rodriguez, known as Benny by the others, Smalls becomes a proficient player. Smalls joins his new friends, Benny Rodriguez, Hamilton 'Ham' Porter, Michael 'Squints' Palledorous, Alan 'Yeah-Yeah' McClennon, Bertram Grover Weeks, Kenny DeNunez, Timmy Timmons and Tommy 'Repeat' Timmons on their many misadventures including being banned from the pool, besting a snooty long-time rival team, and getting sick on one of the rides at an amusement park.
He then learns that many of the team's baseballs have ended up in Mr. Mertle's junkyard over the sandlot's back fence, which is protected by a giant dog known as "The Beast", who had allegedly eaten a kid foolish enough to enter it. One day, when Benny hits the hide off of the team's last ball, Smalls substitutes one from his stepfather's prized collection. When this ball is also lost over the fence, Smalls reveals that the ball is special. To the team's horror, they learn the ball has Babe Ruth's autograph, making it valuable--something Smalls didn't know when he took it. The team constructs a progressively complex series of machines to recover it remotely, but each attempt ends in failure and the ball itself grows increasingly damaged due to attention from the Beast.
While Smalls prepares to face certain discipline from his stepfather for the loss of the signed baseball, Benny has a dream where Babe Ruth encourages him to follow his heart. Inspired by his idol, Benny climbs the fence the next day, resolving to retrieve the ball himself, but he is confronted by the Beast, a large English Mastiff. After recovering the ball, he leads the Beast on a lengthy chase around the neighborhood, which ends with the sandlot fence's collapse, which pins the dog. Overcoming their fear of the dog, Smalls and Benny free the Beast and return the dog to its owner, Mr. Mertle, who reveals that he wasn't the kind of person the team thought he was. Understanding Smalls' predicament with the now-damaged ball, Mr. Mertle reveals himself as a retired Negro League baseball player who knew Babe Ruth personally, and offers him another baseball signed by the entire 1927 Yankees team, including Ruth. Smalls presents the baseball signed by the Murderers' Row to his stepfather, who is impressed by the replacement but still angry that he stole the first ball. Smalls doesn't feel too bad when Bill only grounds him for a week, instead of the rest of his life, and things work out between the two.
The sandlot kids continue playing baseball over the summers, joined by the Beast, now known by his real name of Hercules, as the team's mascot.
The kids eventually grow up. Yeah-Yeah is shipped off to military school, Bertram gets really into the 60's and is never seen again, Timmy and Tommy become an architect and a contractor, Squints marries Wendy the lifeguard, has 9 kids with her and becomes the owner of the town's drugstore, Ham becomes a professional wrestler known as "The Great Hambino", Kenny goes on to play Triple-A (baseball) but doesn't make it to the major leagues and Benny is revealed to have become a star MLB player (earning the nickname "The Jet"), while Smalls has become a sports announcer. The movie ends with Benny running fast, stealing home plate and winning the pennant for the Los Angeles Dodgers. The crowd cheers. Benny looks up at Smalls in the announcer box and gives him the thumbs up and Smalls gives Kenny the thumbs up, too. Smalls smiles and looks at the photo on the wall of him and the gang standing in the Sandlot together.

Question: What pins the dog?
Answer: The Sandlot's fence
Alternative answer: A fence.