BOSTON -- Hanley Ramirez finally ended another long night for the Boston Red Sox, and his teammates found just enough energy to celebrate his walk-off shot.
Ramirez hit a drive out of Fenway Park in the 15th inning, giving the Red Sox a 5-4 win over the Toronto Blue Jays in a rain-delayed game that ended at 1:09 a.m. Wednesday.
"This was a gritty win and a very important win," Boston manager John Farrell said.
It was also an exhausting one. After the start was pushed back an hour Tuesday night because of thunderstorms, the Blue Jays and Red Sox played for 4 hours and 59 minutes. The Red Sox rallied from a 3-1 deficit to tie it in the seventh, and came back again after Toronto regained the lead with one run in the 11th.
The 4-all tie lasted until Ramirez drove the first pitch of the bottom of the 15th high into the Boston night - or morning - and trotted around the bases for a subdued celebration with his weary teammates at home plate.
The Red Sox haven't gotten a lot of rest lately. They lost in 16 innings to the Yankees on Saturday, then split a day-night doubleheader with New York on Sunday. Boston lost to Toronto 4-3 on Monday night - albeit in just nine innings.
"There's a lot of toll and it's not just the number of innings pitched. It's the hours on the feet by every guy that's manning his position," Farrell said. "They've done an outstanding job to go through this stretch of four days we've just come through."
A few hundred fans stayed until the end, including a solid contingent of Blue Jays' supporters. Sometime around the second seventh-inning stretch in the middle of the 14th, the opposing sides joined together in an anti-Yankees chant.
"It's fun to be part of games like that. Extra innings isn't the fun part, but the way the game played out where both teams could have scored and both teams had their chances, that made the game fun," said Mookie Betts, who hit an RBI single with two outs in the 11th to keep the game going.
Hector Velazquez (2-1), Boston's fifth pitcher, got the win. Mike Bolsinger (0-3) pitched three shutout innings before Ramirez hit his only pitch of the 15th out for his 15th homer of the season.
"It's better that we got the W. It's worth it," Ramirez said. "We came from behind a couple of times. That's a good win."
Justin Smoak, Kendrys Morales and Troy Tulowitzki drove in one run apiece with consecutive hits during Toronto's three-run fifth inning, which gave the Blue Jays a 3-1 lead. Ryan Goins put Toronto ahead 4-3 with a sacrifice fly in the 11th.
"Tough one to lose, but they battled," Toronto manager John Gibbons said. "We had a couple of opportunities. We couldn't capitalize, especially early in the game."
Boston rookie Brian Johnson, called up earlier Tuesday from Triple-A Pawtucket, remained unbeaten thanks to the late rally. Johnson allowed three runs, all earned, and eight hits over six innings with three walks and four strikeouts.
J.A. Happ pitched five-plus innings for Toronto, allowing two runs and eight hits before getting pulled in the sixth.
Pedroia followed up his clutch hits with one of the defensive plays of the game in the eighth. After Toronto opened the inning with back-to-back singles, the Red Sox star second baseman scooped up a grounder, ran down Steve Pearce to tag him and made a quick throw to first to convert the double play.
Ramirez, who played first base for just the third time this season, was happy to share some of the credit in the locker room.
"Pedey can do it all. That's why he is who he is," Ramirez said. "It's unbelievable, but the biggest thing is heart. He's a great, great teammate, a great person, a great guy."
Gibbons said the Blue Jays' bullpen was a little beat up after it was all over, but credited Bolsinger for pitching three strong innings when Toronto needed someone to stay out there.
Bolsinger said other than the curveball Ramirez seemed to be expecting in the 15th, he was pleased with his performance.
"I understand my role is to save the bullpen," Bolsinger said. "I enjoy it."
Blue Jays: RHP Francisco Liriano (neck stiffness/pain) threw on the field and could start the series finale Thursday afternoon, depending on how he feels. He left in the third inning Saturday because his neck was bothering him.
Red Sox: SS Xander Bogaerts was a late scratch from the starting lineup and had an MRI on his right hand, which has been bothering him since getting hit by a pitch July 6 against Tampa Bay. Bogaerts came off the bench as a pinch-runner in the 11th.
Blue Jays: RHP Aaron Sanchez (1-2, 3.94) has won his last four starts against the Red Sox.
Red Sox: LHP Drew Pomeranz (9-4, 3.75) has won three of his last four starts, getting a no-decision his last time out Friday against the New York Yankees.