Castellanos had a season-high four hits and matched a season best with four RBIs. Victor Martinez added four hits, while J.D. Martinez had three hits and two RBIs.
Mayckol Guaipe (0-1) took the loss after allowing three runs on two hits and a walk without getting an out in relief.
Alfredo Simon (8-5) gave up five runs on eight hits in 5 2/3 innings to earn the win.
Mariners starter Hisashi Iwakuma allowed five runs on eight hits in five-plus innings. He struck out three in his return from a strain in his back and right shoulder area that sent him to the disabled list in April.
Guaipe took over with a 5-4 lead, a runner on first and no outs in the sixth. Castellanos bounced him from the game with a two-run single three batters later to put the Tigers up 6-5.
By the time reliever David Rollins was able to get the Mariners out of the sixth, the Tigers had taken an 8-5 lead.
Detroit added four more runs in the seventh.
Castellanos’ second-inning home run was the first of four for the Tigers, all solo shots. Victor Martinez and J.D. Martinez hit back-to-back homers in the fourth inning and Yoenis Cespedes added another to lead off the sixth.
Dustin Ackley hit an RBI triple and Brad Miller followed immediately with a run-scoring double in the fourth to cut the Tigers’ lead to 3-2. Logan Morrison hit a three-run home run in the fifth to put the Mariners up 5-3.
Blaine Hardy, Ian Krol and Bruce Rondon combined to pitch 3 2/3 scoreless innings in relief for the Tigers.
Tigers: With first baseman Miguel Cabrera on the disabled list with a left calf strain, Detroit has had to look elsewhere at the position. On Monday, the team claimed Marc Krauss off waivers from Tampa Bay. Krauss is expected to split time at the bag with Jefry Marte, as well as Andrew Romine.
Mariners: Iwakuma made his return from the disabled list Monday. The right-hander hadn’t appeared in a major league game since April 20 due to the strain.
Tigers: Rookie Kyle Ryan gets the nod. Ryan, who has started and come out of the bullpen this season, holds a 4.55 ERA and hasn’t had a scoreless outing in seven attempts.
Mariners: Taijuan Walker attempts to follow up one of his best career starts Tuesday against the Detroit Tigers. The young right-hander allowed one hit in six shutout innings to pick up the win at San Diego on July 1.