Ortiz plunked a two-run shot off the windows of the cafe in right field at Safeco Field for a 2-0 lead, his 18th of the season. He drove in another run in the third on a line drive that barely cleared the glove of Seattle right fielder Stefan Romero.
Seattle's five-game win streak was snapped.
Ortiz's big hits backed the return of Clay Buchholz to the Boston rotation. Buchholz (3-4) was knocked around in the second, giving up home runs to Kyle Seager and Mike Zunino, but otherwise avoided problems. Buchholz retired 11 of 12 during one stretch and pitched out of trouble in the sixth inning when the first two batters reached on singles.
Buchholz won for the first time since May 2. He had been on the disabled list since May 27 with a hyperextended left knee and after two rehab starts in the minors was brought back to the Red Sox's rotation.
Buchholz went 7 1-3 innings, giving up seven hits and four runs. He struck out two and walked none.
Seager continued his tear at home with his 12th home run of the season 11th at Safeco Field leading off the second. Logan Morrison followed with a single and Zunino lined his 11th homer to give Seattle a 3-2 lead. But that was about all the Mariners could do against Buchholz.
Endy Chavez and James Jones led off the sixth with singles, but Buchholz got a shallow fly ball from Robinson Cano and Seager grounded into an inning-ending double play.
Brad Miller homered on the first pitch of the eighth inning from Buchholz, cutting the deficit to 5-4. After Jonny Gomes made a diving catch of Romero's liner, Buchholz was pulled.
Andrew Miller entered and struck out pinch-hitters Willie Bloomquist and Cole Gillespie to end the eighth. Koji Uehara pitched the ninth for his 16th save despite allowing two runners.
Seattle starter Hisashi Iwakuma struggled for the second straight outing, his pitches missing location. Iwakuma (5-4) lasted just four innings, giving up eight hits and five earned runs.
Iwakuma was done when he failed to record an out after the first three batters of the fifth inning. He gave up singles to Brady Holt and Daniel Nava and wasn't close on a 3-2 pitch to Dustin Pedroia to load the bases with no outs and Ortiz coming to the plate. Iwakuma was replaced by Tom Wilhelmsen, who got Ortiz to ground into a double play, but Holt scored for a 5-3 lead.
This wasn't the first time Boston has made Iwakuma's night short. Last season, Iwakuma lasted a career-low three innings, giving up eight hits and six runs against the Red Sox.
NOTES: Ortiz is tied for 36th on the all-time home run list with Jeff Bagwell and Vladimir Guerrero. ... Boston RHP Brandon Workman will start Friday's opener in New York against the Yankees. ... Seattle recalled RHP Brandon Maurer to work out of the bullpen. He was a starter earlier in the season.