Everything had gone so smoothly during a sun-soaked season opener for the Indians.

A perfect day.

Chris Perez blew it.

Cleveland's All-Star closer couldn't protect a three-run lead in the ninth inning, allowing Toronto to tie it and the Blue Jays went on to win the longest opening-day game in the majors leagues, 7-4 in 16 innings over the Indians on Thursday.

J.P. Arencibia hit a three-run homer off Jairo Asencio in the 16th for the Blue Jays, who were three outs away from their first loss before batting back against the normally reliable Perez.

"I feel terrible," said Perez, who had 36 saves last season. "Everybody did their job today except me."

For eight innings, things went the Indians' way.

They got a dominant performance by starter Justin Masterson, who allowed just two hits and struck out 10 against one of the AL's most dangerous lineups. Jack Hannahan hit a three-run homer to stake Cleveland to a 4-0 lead, and the Indians did enough defensively to give a sellout crowd reason to think victory No. 1 of a new season was in the books.

Needing just three outs, Indians manager Manny Acta turned the game over to Perez, who couldn't close the opener.

"I take the blame," Perez said. "A three-run save, the easiest in baseball."

The marathon eclipsed the previous longest openers — 15 innings between Cleveland and Detroit on April 19, 1960, and 15 innings between Philadelphia and Washington on April 13, 1926.

According to STATS LLC, the Indians-Blue Jays opener was the longest of 1,360 opening-day games played since 1901.

"If you're going to break records you might as well do it on opening day," said Perez, who was able to show some humor after his ninth-inning meltdown.

Luis Perez, Toronto's seventh pitcher, worked four scoreless innings for the win and Sergio Santos got two outs to end the 5-hour, 14-minute game which began in bright sunshine and ended in darkness.

Jose Bautista homered and hit a sacrifice fly for Toronto, which did next to nothing against Masterson before storming back in the ninth.

Hannahan connected against Ricky Romero in the second, giving Cleveland a 4-0 lead. But the Indians didn't score again, blanked for 14 innings to disappoint a crowd of 43,190 that thinned to just a few thousand diehards by the end.

This one had a little of everything: strong pitching, bad pitching, blown chances, emptied benches and bullpens, a soon-to-be 45-year-old infielder playing the outfield and, of course, a spot in baseball annals.

"I guess we got in the record books," Masterson said. "That's something. Who started it? That's a trivia question."

In the 16th, moments after the teams had rewritten the history books, Asencio walked Brett Lawrie and Omar Vizquel was safe on a failed fielder's choice before Arencibia, who hit 23 homers as a rookie last season, drove a pitch onto the pedestrian plaza in left.

He was lucky it ever got there.

After taking a ball, Arencibia thought third base coach Brian Butterfield had given him the bunt sign and he popped his attempt foul.

"For some reason, I thought I got the bunt sign," Arencibia said. "That got me in two strikes. Then I was just trying to hit the ball. I happened to hit it hard and got it out of the park."

Arencibia was unaware of his gaffe until he got back into the dugout, where Blue Jays manager John Farrell told him what he had done.

"He high-fived me and said, 'Great job, you missed a sign,'" Arencibia said, laughing.

The Indians squandered a potential game-winning situation in the 12th.

They loaded the bases on two walks and a single before Farrell brought 44-year-old shortstop Vizquel off the bench as a fifth infielder. The strategy worked when Asdrubal Cabrera swung at Perez's first pitch and bounced into an inning-ending double play.

"We had some good opportunities," Hannahan said. "But that's baseball. You can do everything right and still come up short."

Toronto trailed 4-1 going into the ninth. But the Blue Jays rallied for three runs off Perez, who missed most of spring training with a strained side muscle and looked awful.

He gave up two singles to start the inning before Bautista's sacrifice fly made it 4-2. Kelly Johnson took second on the play, and after Adam Lind walked, Edwin Encarnacion hit a tying two-run double.

Perez, who said he felt fine, got an out, but walked Eric Thames. Perez was then pulled by Acta before hanging his head and walking dejectedly to the dugout showered by boos.

"If you ask me the zip on his fastball wasn't there," Bautista said of Perez. "I don't know if it was the cold or what it was. That's to our advantage. He fell behind. He threw some pitches over the plate and we were able to capitalize."

Masterson set an early tone, striking out the side in the first. He retired the side in order four times, and except for giving up Bautista's homer, was never in serious trouble.

Hannahan's third career opening-day homer put the Indians up by four.

Later, he didn't know the game had reached historic proportions.

"It felt really long," he said.

NOTES: 1B Casey Kotchman drove in Cleveland's first run but went 0 for 7 in his first game for the Indians, who signed him as a free agent in February. ... Arencibia has a thing for debuts. He hit two homers on opening day last season and connected for two in his first major league game in 2010. ... The Indians have had six home openers go to extras since Progressive Field opened in 1994. ... Cleveland has lost four straight openers and eight of 10. ... Cleveland pitchers combined for 16 strikeouts. ... Farrell began his playing career with Cleveland and pitched five seasons for the Indians, often taking the mound in less-than-ideal-conditions in old Cleveland Stadium. "I pitched in the snow before," he said. "Opening day on the Great Lakes is a risky proposition."