Bradley Beal fights with Iman Shumpert for a loose ball during the Wizards’ win against the Knicks. (Brad Penner/Usa Today Sports)

The Washington Wizards were in Madison Square Garden, in a similar spot as they were four months ago – trailing by one point in the game’s final minute, with the ball in Bradley Beal’s hands.

The New York Knicks were more prepared the second time around, putting their best perimeter defender on Beal, but the result was the same. The second-year shooting guard made another crucial shot in the waning moments to lift the Wizards to a 90-89 victory.

Rarely one to show much emotion on the court, Beal couldn’t resist relishing in his moment after he drove left around Iman Shumpert and hit a pull-up, 20-foot jumper with 22 seconds remaining in the faces of both Carmelo Anthony and Tyson Chandler. As he ran down the court to the Wizards’ bench, Beal curled his lips and pushed his hands toward the floor to flaunt.

“Just a little cockiness,” Beal said afterward, flashing a grin. “You’ve got to have a little bit of that in your game. It was a big shot. I had to throw a little swag in it.”

Beal has never hid his affinity for playing road games against the Knicks, with the theater lighting and an audience of A-list celebrities and rowdy fans creating an atmosphere primed for a huge performance. After beating the Knicks with a driving layup with six seconds left in his previous trip to the Garden on Dec. 16, Beal returned to finish with 28 points on Friday and got a chest-bump from John Wall after the buzzer sounded.

The Post Sports Live crew debates whether the Wizards would be better off falling to the number 7 seed in the Eastern Conference playoffs and facing the reeling Pacers in the first round. (Post Sports Live/The Washington Post)

“Bradley, he played like he’s from different planet,” Marcin Gortat said of Beal, who scored 13 in the fourth quarter. “He had fun. Two games in New York, we won both, and he was the hero. He was knocking down all of the shots.”

Unlike the previous game in New York, which ended with Anthony rushing up a desperation heave and slinging his headband to the floor, the Knicks actually had time to respond Friday. The Knicks turned again to Anthony, their leading scorer, for the final shot. Anthony went left, but with Trevor Ariza smothering him, he lost the ball, leading to a fallaway three-pointer by J.R. Smith that hit the back of the rim as time expired.

“That was a physical war out there,” Coach Randy Wittman said. “I told our guys afterward, that is a game you will face in the playoffs. It was a slugfest.”

Wall had 19 points and nine assists and Marcin Gortat had 13 points and 10 rebounds. Ariza only had 10 points, but he also limited Anthony to 10 points — 18 below his season average. Anthony said afterward that he was playing with a sore right shoulder, which contributed to him shooting just 5 of 14 from the floor with nine turnovers.

“Aw man, I’m dead right now,” said Ariza, who contended with Anthony and a bout of the flu. “I’m just fatigued. But this was an important game for us. I tried to give everything I had. I tried to deny him the ball. Tried to stay on him as much as I can. Try to make as tough as I can.”

The Wizards (40-36), still basking in the afterglow of clinching their first playoff berth in six years two nights earlier, weren’t able to celebrate too long with a chance to possibly catch Brooklyn for the fifth seed and hold off seventh-place Charlotte, which defeated Orlando on Friday night. They caught a red-hot Knicks team, owners of the second-largest payroll in the NBA, trying to overcome a disappointing start and make a run for the No. 8 playoff seed.

New York (33-44), which had won 12 of their previous 15, dropped back to ninth after losing for the third time to the Wizards. The Knicks led 84-83 on a pair of free throws from Raymond Felton, but the Wizards recaptured the lead when Wall rebounded a Smith miss and tossed the ball ahead to Beal, who got fouled by Smith while throwing down a dunk. Smith knocked Beal to the ground and he was slow to get up, but eventually made the free throw.

The Wizards went up 88-84 when Wall drove to his right and made a floater. Knicks Coach Woodson called a timeout and Wall leaned down as he ran back to his bench, collecting low fives from his excited teammates.

“No. Never,” Wall said, when asked if the thought the game was secure. “Not with a minute-something left. Never in that situation, because it’s a lot of basketball left and we gave up leads in that situation before. We were excited to go up four, but we knew we had to get stops.”

The Wizards, though, didn’t get stops. Anthony made a jumper and Felton a three-pointer to give the Knicks a lead, setting the stage for Beal to live up to a declaration that he had made to teammate Kevin Seraphin at the start of the fourth quarter.

“I wasn’t going to let us lose,” Beal said. “That was my mentality. At the beginning of the fourth quarter, I told Kev that. That was on my mind throughout the whole game — I won’t let us lose. Whatever it takes. Sure enough, we didn’t lose.”

Beal’s winner was reminiscent of his December heroics. Before Friday’s game, Beal said he was hoping to have a repeat performance. This time, he got the bucket and got to gloat after hushing the fans.

“It’s pretty cool. It’s so loud and they’re rooting against you. For them to go silent, it’s kind of like, ‘Wow,’ ” Beal said. “It was great. I love playing here.”