Luciano Acosta recorded a hat trick as D.C. United beat Orlando City, 3-2, on a miracle goal in stoppage time. (Nick Wass/AP)

Wayne Rooney came to Washington to score goals and to inject superstardom into a soccer market longing for an international hero to perform wonders in a new stadium.

But to chug some 40 yards, deep into stoppage time, on a humid night and chase down an opponent eyeing a winning strike into an unoccupied net, hop back onto his feet and drive a long cross with pinpoint accuracy to a teammate for the winning goal in an MLS match that had already exceeded all rational expectations?

Come on.

It happened near the end of D.C. United’s 3-2 victory over shorthanded Orlando City on Sunday night, a moment less than a month into Audi Field’s existence on a play that will surely go down as one of the most extraordinary in the club’s 23-season history and endear the English forward to the local faithful for years to come.

With goalkeeper David Ousted pressed forward on a D.C. corner kick, Rooney raced back and executed a flawless tackle as Will Johnson was preparing to pump the ball into an open net from 50 yards and send United to a crushing defeat.

He then served the ball to Luciano Acosta, a 5-foot-3 midfielder, for a seven-yard header in the dying seconds to cap Acosta’s first MLS hat trick and touch off wild celebrations on the field and in the stands.

“We went from losing the game basically,” Rooney said, “to winning in the space of five seconds.”

Acosta jumped onto the barrier in front of the supporters’ groups and disappeared into a swarm of jubilant fans. Other players embraced Rooney near midfield.

After a video replay confirmed the goal, Rooney fell onto his back and rolled over.

“The play he makes is what he is about,” Coach Ben Olsen said. “We’ll see that more and more as he is here. He is a winner. He’s selfless. He’s come here to prove himself even though he doesn’t need to. That play is indicative of who he is.”

Since his debut last month, the former Manchester United and English national team star has scored once, assisted three times and suffered a broken nose with five stitches after defending a corner kick against Colorado.

On this night, after United (5-9-6) conceded the tying goal despite having a man advantage, Olsen took a massive risk by instructing Ousted to join the fray on a corner kick.

“That’s on me. No risk, no reward?” Olsen said sheepishly.

The decision backfired as Orlando cleared the ball. Johnson had acres of space in front of him and, with Ousted well out of position, the 32-year-old Rooney ran him down and tackled the ball away.

“I told him he looked like he was 18 again,” defender Kofi Opare said. “He said, ‘Man, that’s the fastest I’ve ever run.’ ”

Asked about the tackle, Ousted said, “We could play him at center back. It was amazing. It was one of those clutch moments that hopefully we will look back on this season and say that made a difference.”

After collecting the ball, Rooney picked out Acosta, who outjumped 5-9 Chris Mueller for the header into the far side of the net.

Just before the corner kick, Acosta said he had volunteered to stay back a bit in case Orlando counterattacked quickly.

“I’m going to go [back] and you stay here,” Acosta said he told Rooney. “Wayne said, “No, no. You stay here and I’ll go.’ I looked at him like, ‘You are going to run all the way back?’ And look what happened.”

Commenting on Rooney’s effort, Acosta added: “Seeing a player like Wayne make that effort and run all the way back and make that tackle, put in that work, it motivates all of us, especially with the euphoria of the game. It all comes back to Mister Wayne.”

Acosta and Rooney had combined on the last sequence of the first half as well, with Acosta accepting a touch as he infiltrated the penalty area to beat Joe Bendik with an angled smash.

Orlando (7-15-2) drew level in the 50th minute thanks to an own goal. Oriol Rosell hustled to prevent the ball from crossing the end line and one-timed a cross. Defender Steve Birnbaum stuck out his left foot, inadvertently deflecting the ball past Ousted.

The match turned five minutes later. Orlando was launching a counterattack when, away from the ball, Cristian Higuita elbowed Yamil Asad in the head. Referee Jose Carlos Rivero did not see the blow, but video assistant referee Jorge Gonzalez did, resulting in a red card.

Nine dominant minutes later, United broke the deadlock, but not without assistance from video replay again.

Asad lofted the ball into the penalty area. Acosta, all of 130 pounds, was unmarked as he chased the aerial service. Here came the 6-3, 223-pound Bendik.

Acosta got there first, volleying past the leaping Bendik, whose hip smashed into Acosta’s head.

Initially the goal was nullified by an offside call, but Rivero awarded the goal after reviewing video.

With a goal and man advantage, United gave the lead away. Rosell played a through ball to Dwyer, who had shed Birnbaum to race into the clear. Ousted came out, so Dwyer flipped the ball over him.

Bendik made superb saves on Darren Mattocks and Russell Canouse before Rooney and Acosta worked their magic.

“It does have that feeling – the energy out there,” Olsen said of the potential season-turning victory. “That’s also part of this … journey we are on, creating memories for this building. This was one of those games you’ll talk about down the road.”

Read more:

Tim Weah will score many goals in his career. This will be the silliest.

D.C. United’s youngest player, Chris Durkin, focuses on development in first MLS season

‘I’m back home’: D.C. United introduces Hamid, Vytas