BOSTON -- The Red Sox staged their own impromptu Boston marathon and wearily won it, adding a game to their AL East lead on an eventful day at Fenway Park.
Hanley Ramirez hit an RBI single in the 19th inning as Boston outlasted the Toronto Blue Jays 3-2 in a game that spanned six hours and ended early Wednesday.
It was 1:11 a.m. when Mookie Betts led off with a double and Ramirez followed with a bloop single. The AL East leaders ended a three-game losing streak.
"That was a team win right there," Ramirez said. "Sometimes it's not going to be easy. There's a lot of things in our way, but nothing's going to stop us from continuing to where we want to go and what we want to be. We want to be a champion."
About 700 fans stayed until the end to see Boston win the longest game in the majors since July 2016, when Cleveland beat Toronto 2-1 in 19 innings. The Red Sox forced extra innings by rallying for two runs in the bottom of the ninth.
Red Sox first baseman Mitch Moreland was 31 years old when his RBI grounder tied it at 2-2 - he turned 32 when his birthday came at midnight, and celebrated with a win.
Boston increased its division lead to 3 1/2 games over New York. But the Yankees still made it a rough day for their longtime rival.
On Tuesday, The New York Times reported the Red Sox admitted to Major League Baseball they used an Apple Watch to steal signals from opposing catchers - including the Yankees - and relay them to Boston players. While swiping signs has long been part of the game, using electronic devices to do it is against the rules.
Commissioner Rob Manfred happened to be at Fenway for the game as part of a previously planned visit.
This was the second-longest game ever at Fenway, which opened in 1912. The Red Sox lost to Seattle 8-7 in 20 innings in 1981 - that game was suspended after 19 innings past 1 a.m. because of an American League curfew rule, and resumed about 18 hours later.
The fans who stuck around this time enjoyed an encore of "Take Me Out to the Ballgame" in the 14th, then a timely number to start the 19th with the Rolling Stones hit "19th Nervous Breakdown."
Boston used 12 pitchers against the Blue Jays, tying an American League record set a day earlier by the Los Angeles Angels.
"Just an outstanding job every guy that came to the mound," Boston manager John Farrell said.
Hector Velazquez (3-1) picked up the win. Chris Rowley (1-2) lost in his fourth inning of relief. Red Sox center fielder Jackie Bradley Jr. helped save it when he threw out Jose Bautista at the plate to end the top of the 11th, after he tried to score on a flyball.
"It's a two-run game for 19 innings? In this park?" said Toronto bench coach DeMarlo Hale, filling in as acting manager for the fourth game in a row. "There was some pretty good pitching going on both sides."
After crossing with the winning run, Betts and the rest of the Red Sox still had enough energy to circle around for Ramirez, who led a brief chase into shallow right field before his teammates chased him down to celebrate another walkoff win.
Osuna walked Andrew Benintendi to start the ninth and Betts doubled. Benintendi scored when Ramirez grounded out, which allowed Betts to take third. Moreland then hit a sharp grounder to second that scored Betts.
Morales led off the sixth with a homer off Eduardo Rodriguez for a 2-0 lead.
Toronto starter Marco Estrada held Boston to three hits over seven shutout innings.
"I don't think I've ever played in a 19-inning game, and I didn't even have to play in the whole game," Estrada said. "I feel bad for the guys that were out there for the entire game."
Blue Jays: Toronto manager John Gibbons is away from the team attending to a personal matter.
Red Sox: Activated RHP Carson Smith (Tommy John surgery) from the 60-day DL. Manager John Farrell said Smith was still a little sore after taking a line drive off his leg during his final rehab start over the weekend, but was cleared to play. Smith pitched a hitless 18th.
Blue Jays: RHP Joe Biagini (3-9, 5.01 ERA) had a career-high 10 strikeouts over seven innings Friday in a no-decision against Baltimore.
Red Sox: RHP Doug Fister (4-7, 4.19) is 0-1 in two starts against Toronto this season.