It’s been almost two decades since the first time the Yankees played the Mets, and the common belief is that the Subway Series has long lost its original intrigue and luster. But then games like Wednesday night’s happen — games that remind everyone that when New York’s baseball teams go head to head, things tend to get weird.

Take for instance, the fifth inning of the Yankees’ 9-5 win, when mild-mannered Mark Teixeira and soft-spoken Steven Matz nearly ignited the world’s unlikeliest brawl at the Satdium.

Matz plunked Teixeira in the left leg with one out in the fifth. Teixeira had hit a homer to put the Yankees up 6-3 in the second inning. Teixeira took a threatening step toward the mound, causing benches and bullpens to clear. Words were exchanged, both players were held back from going any further, and no one was ejected.

Joe Girardi wondered whether Matz hit Teixeira deliberately. “Whenever you hit a home run and get hit in the next at-bat,” Girardi said, “there’s always going to be a question.”

“I know Matz is a good kid, but I told him I didn’t like it,’’ Teixeira said. “I like him a lot . . . If it was on purpose, it’s uncalled for, and if it wasn’t, it just looks really bad.”

Teixeira slid hard into Neil Walker one batter later, when a comebacker to Matz ignited a double play in which the throw and the slide were executed with particular gusto. And, in case anyone thought the matter was settled, reliever Hansel Robles proceeded to get into a tense staredown with Teixeira while he stood on second base in the seventh.

Robles said he believed Teixeira was trying to steal signs. “That’s not the way you play baseball,’’ Robles said. “You have to play baseball as a man.”

Teixeira smiled as he led off second and seemed amused.

“It was one of the funniest things I’ve ever seen on a baseball field,” Teixeira said. “It dawned on me that I’ve gotten inside this guy’s head, just by breathing.’’

As Robles walked off the mound to the third base dugout, he jawed at Teixeira while he was standing on third base.

But that’s how things can go when the Mets play the Yankees, where things are magnified and everyday frustrations threaten to pour out from one at-bat to the next. That certainly seemed clear enough early in the game, as poor pitching and shoddy defense helped produce nine runs before the third inning ended. It came into stark relief in the later innings, when the near-brawl managed to overshadow Luis Severino’s strong relief outing.

Severino came in with two outs in the fourth after a painful showing by starter Chad Green. Severino (1-6) allowed an unearned run, a hit and a walk in 4 1⁄3 innings, striking out five. The Yankees scored three runs each in the first and second innings, and three more against Robles in the seventh, when he allowed three hits and walked two in two-thirds of an inning.

Curtis Granderson kicked off the game with his franchise-leading 18th leadoff homer right over the short porch he’s missed so much, and Walker and Yoenis Cespedes followed with back-to-back singles. Yankees pitching coach Larry Rothschild visited Green three batters in and had the bullpen going shortly thereafter. Green walked Jay Bruce, and James Loney singled to left to bring in Walker. That’s when the Mets’ problems with runners in scoring position came to bite them again: Michael Conforto struck out looking and Wilmer Flores’ weak grounder went down as a 6-4-3 double play.

It would cost them immediately: Rob Refsnyder singled with one out in the first, Teixeira walked, and Chase Headley hit a double that was bobbled by Conforto near the wall in left to tie the score. One batter later, Didi Gregorius doubled to right to give the Yankees the 3-2 lead.

No matter, though, because the absurdities continued in the next inning. Kelly Johnson led off with what should have been a groundout to first, but instead went down as a double when Teixeira misread the ball, ranging to the wrong side, and letting it skitter to the outfield. Rene Rivera singled to tie it at 3, but Teixeira got it all back in the second, when he blasted Matz’s sinker to left-center for a three-run homer and a 6-3 lead.

Green lasted 3 2⁄3 innings, allowing three runs on eight hits before being lifted for Severino. He held the Mets scoreless until the seventh, when they loaded the bases with no outs but scored only once, on Loney’s groundout. The Mets were 2-for-12 with runners in scoring position, putting them at a major-league worst .204, just behind the Yankees, who came in at .219 with runners in scoring position.

Matz (8-8, 3.63 ERA) pitched six innings, giving up six runs before getting replaced by Robles. He has only one win in his last 12 starts.