Detroit and Oakland Win on Game-Ending Homers His tender left hand and sore left hamstring both on ice after a big day, Yoenis Cespedes shared how he reminded himself to keep the celebration to a minimum. Just a standard jump for joy at home plate, nothing fancy that could lead to further injuries. "No chance," he said with a smile, in perfect English. Cespedes, the rookie Cuban slugger, hit a three-run homer in the ninth inning for his first career game-ending shot, lifting the Oakland Athletics to a 4-1 victory over the Los Angeles Dodgers on Thursday to complete their first home sweep of 2012. Cespedes connected with no outs off Josh Lindblom (2-1), sending a drive just inside the left-field foul pole. It was his second game back in the starting lineup after he had only one at-bat in the previous 10 games because of the hamstring injury. "I knew it was in fair territory, but I didn't know it would be a home run," Cespedes said. I'm very happy. My teammates said: "You always do so much. You've hit key home runs to put us ahead, but you still need a walk-off." " Oakland won for the eighth time in nine games after holding the Dodgers, the National League's best team, to eight total hits in the three-game series. The starters Clayton Kershaw and Travis Blackley each allowed one run and three hits in eight innings. Blackley walked none and struck out six, while Kershaw, the N.L. Cy Young Award winner, struck out seven and walked two. The Dodgers were swept for only the second time this season. They dropped four in a row to Milwaukee at home in late May. TIGERS 2, CARDINALS 1 Quintin Berry slapped a base hit through the drawn-in infield, then took off for first base. He raised both hands in the air in celebration, rounded the bag and ripped off his helmet. "I've never had a walk-off before," Berry said. I showed it out there, jumping around, acting crazy. You don't know what to do with yourself. Berry's tiebreaking R.B.I. single in the 10th inning gave host Detroit a win over St. Louis. It was another bright moment for Berry, a 27-year-old rookie outfielder who is hitting .315. Detroit also got an encouraging performance from another youngster, Jacob Turner, who allowed one run and four hits in five innings in his first start of the season. NATIONALS 5, RAYS 2 Reliever Joel Peralta served up a tiebreaking, two-run double to Danny Espinosa in the sixth inning as Tampa Bay lost at Washington. Earlier in the day, Peralta learned that he had been penalized by Major League Baseball for eight games after being caught with pine tar in his glove Tuesday night. Peralta is appealing the decision and can keep playing until a final decision is reached. ROCKIES 4, PHILLIES 1 Chris Nelson hit a go-ahead, two-run homer in the seventh inning, and Wilin Rosario added a two-run shot in the ninth to help visiting Colorado end a four-game losing streak. RED SOX 6, MARLINS 5 Daniel Nava singled in the go-ahead run to cap a three-run eighth inning, and host Boston completed a sweep of stumbling Miami. Boston tied the score on a two-run homer by Will Middlebrooks, who drove in four runs. Ryan Kalish then singled, raced to third on a groundout to first and scored on Nava's single up the middle. PIRATES 9, TWINS 1 James McDonald pitched his first career complete game, Garrett Jones hit one of Pittsburgh's three home runs and the Pirates won for the fourth time in five games, over visiting Minnesota. BEACHY ELBOW SURGERY The Braves said Brandon Beachy had successful right elbow ligament-replacement surgery. The operation to reconstruct the partially torn ulnar collateral ligament in Beachy's elbow was performed by Dr. James Andrews in Gulf Breeze, Fla. Andrews has performed many of the ligament replacement operations known as Tommy John surgery. Beachy faces a recovery period of at least one year. TULOWITZKI HAS GROIN SURGERY Colorado Rockies shortstop Troy Tulowitzki had surgery on his left groin to remove scar tissue. He will be out at least six weeks. Tulowitzki, who has been sidelined since May 30, was hitting .287 with 8 homers and 27 R.B.I. in 47 games. MINOR LEAGUER TO BLUE JAYS The Kansas City Royals have sent the minor league pitcher Sean O'Sullivan to the Toronto Blue Jays for cash.