At some moment late last night that thought entered the mind of everyone involved in the game at Fenway Park. Eighteenth and final matchup between the teams in the regular season. Two outs. Bottom of the ninth. Bases loaded. One-run game.

Of course it had to be Mariano Rivera vs. David Ortiz.

“Why wouldn’t it be?” Doug Mientkiewicz said.

These are the Yankees and Red Sox, and so it had to be. The great closer vs., well, the great offensive closer of games. Mo vs. the Walk-Off King.

“It didn’t surprise me,” Joe Torre said.

The only surprise is when the Yankees and Red Sox fail to thrill. That was not the case last night as The Rivals stuffed a month of storylines, drama and tension into 8½ innings, and then the simple sight of Rivera vs. Ortiz trumped it all in the bottom of the ninth. It was an encore moment in this great concert that never ends.

“It was a good way to finish off this series for the year,” Johnny Damon said. “Mo made his pitches and so we get to home happy.”

The Yankees won 4-3. They won this series by capturing the opener and finale in heart-racing fashion. They won the season series over the Red Sox 10-8. Yet, they are unlikely to catch the Red Sox in the AL East. But this series victory was vital because, as Damon said, “no one is helping us out with the Tigers.”

As they assembled before the game yesterday, the Yanks already knew Detroit had won a fifth straight game and for the 10th time in 12 games. Torre has done a terrific job of convincing his players to worry only about maximizing the Yankees win total and not to become obsessed with what others do. But how do you ignore that a loss would mean that the Tigers had crawled within 1½ games?

So there was pressure on Roger Clemens. He had not pitched since Sept. 3, two weeks and two cortisone shots to his elbow ago. He was matched against his protégé, Curt Schilling, in a reprise of Game 7 of the 2001 World Series. Both players have lost something off their fastball, but not their competitiveness.

Both were superb. Clemens permitted one unearned run in six innings. Through seven innings, Schilling, with less power and more efficiency, had limited the Yanks to a Robinson Cano solo homer. But for the second time in this series, the Yankees found eighth-inning brilliance. In the opener, they rallied from 7-2 down with six runs in the eighth. And last night Derek Jeter scorched a two-out, three-run homer to knock out Schilling and break a 1-1 tie.

Joba Chamberlain, who worked around a leadoff double in the seventh, permitted his first major-league homer (to Mike Lowell) in the eighth. Thus, Rivera was handed a 4-2 lead in the ninth. But because Yankees-Red Sox can always use more plot twists, Rivera came in at less than 100 percent. While warming up in the eighth inning, he was accidentally struck on his right elbow by a ball thrown in the Red Sox bullpen. According to Ron Villone, Rivera “couldn’t feel his arm.”

That explains why a man who had walked eight men all year, walked two, hit a batter and permitted a double by Julio Lugo. That meant one run in, bases loaded, two down and Big Papi due. Torre visited the mound essentially to break the tension. “What do I say, ‘pitch him carefully,” Torre joked.

The strategy was handled by Jorge Posada and Rivera. “Attack him and attack him in,” Rivera said. “That is my best pitch. That is his powerhouse. Strength vs. strength.”

For Rivera that meant cutter, cutter, cutter, cutter and then one last 93 mph cutter, with a 2-2 count, veering toward Ortiz’s hands. Big Papi had a big popout, the ball fittingly landing in Jeter’s glove. The final out in the 18th and final game of this regular season between the Yankees and Red Sox had been registered.