For much of the past 18 years, the Yankees have relied on Mariano Rivera to pitch in the late innings with games on the line.

That certainty helped them become perennial contenders and secure five championships. But the Rivera era is coming to a close.

“It’s official now,” Rivera, 43, said Saturday. “After this year, I will be retired,”

The element of surprise had been dashed days before Rivera made the announcement with his wife, Clara, and two of their sons by his side at Steinbrenner Field in Tampa, Fla. His intentions were clear on Thursday when the Yankees scheduled the news conference, which was televised nationally and streamed online.

Rivera hinted at retirement in 2012, and he confirmed on Saturday that had he not been injured most of last season, he would not be pitching now. But Rivera tore the anterior cruciate ligament in his right knee on May 3 while shagging fly balls in batting practice and missed the rest of the season.

“I didn’t want to leave like that,” he said, adding, “I still have something left.”