In its first playoff game since winning the 2017 MLS Cup, Toronto FC showed resilience and character in spades.

Jonathan Osorio scored twice and Richie Laryea and Nick DeLeon added two more in a four-goal extra-time outburst as Toronto, dodging a bullet after conceding a stoppage-time equalizer, posted a wild 5-1 victory Saturday that ended D.C. United's season and Wayne Rooney's MLS career.

The goals came in the first half of the 30-minute extra time — the 93rd, 95th, 103rd and 105th minute — turning the game on its head.

"Incredible response," said captain Michael Bradley.

"The response, the mentality to not let that [tying goal] faze us, to regroup and be ready to go again. That part was a sign of a big team," he added.

Toronto, which extended its unbeaten run to 11 games (5-0-6), had seemed destined for victory thanks to Marky Delgado's 32nd-minute goal. But that all changed three minutes into second-half stoppage time when Argentine midfielder Lucas Rodriguez swept in a Rooney corner after Frederic Brillant nudged the ball over to the far post.

The goal silenced the announced crowd of 25,331 at BMO Field. Then Toronto took over in extra time.

WATCH | Local heroes lead TFC to playoff win in extra time:

Toronto's Jonathan Osorio tallied twice in Toronto FC's 5-1 victory over DC United to advance to the second round of the MLS playoffs. 1:21

"There were, for lack of a better word, some pissed-off guys going into overtime," said DeLeon, who had been tasked with marking the man who scored the equalizer off the corner. "So some very motivated guys. And I think it showed."

Laryea beat D.C. goalkeeper Bill Hamid from close range three minutes into extra time after Michael Bradley stole the ball and fed DeLeon, who slipped the ball to Laryea. Two minutes later Drew Moor — who like Laryea had come in off the bench — headed an Alejandro Pozuelo corner into the goalfront where Osorio banged it in amidst a scrum of bodies.

Pozuelo then spotted Osorio steaming towards goal and the Canadian midfielder hammered a volley from just inside the penalty box. DeLeon, a former D.C. United player, made it 5-1 with a swerving shot from distance after a Pozuelo corner.

Toronto readies for rested NYCFC

Toronto moves on to New York to face a rested NYCFC on Wednesday. The top team in the East, which finished 14 points ahead of TFC in the regular season play, has been off since Oct. 6.

Toronto blanked NYCFC 4-0 at BMO Field on March 29, when Pozuelo dazzled in his MLS debut with two goals and an assist. The teams tied 1-1 at Yankee Stadium on Sept. 11.

"We're confident that the matchup makes sense for us," Vanney said of NYCFC. "Now we've got to recover. We've got to get everyone to the best possible physical state. I think mentally we're in a great spot."

TFC was without star striker Jozy Altidore [quad] and influential centre back Omar Gonzalez [hamstring] on Saturday. Fellow centre back Chris Mavinga limped off in the 107th minute.

"I suspect he'll be fine," said Vanney.

Toronto had made three substitutions before the tying goal so Vanney was forced to rejig his formation into a 3-5-2 — with Pozuelo and DeLeon up front — as TFC went for the win in extra time.

D.C. United, meanwhile, lost Paul Arriola to a second yellow card in the 118th minute.

The visitors didn't manage a shot on target in the first hour but finished with six on 14 attempts as they came alive in the second half. Toronto launched 28 shots, with 17 on target.

Credit goalkeeper Quentin Westberg for the stiff defence. He made several key saves, including a wonderful stop on Ola Kamara in the 77th minute when the Norwegian sub was gifted a scoring chance on an awful Nicolas Benezet backpass.

Rooney's farewell

Toronto went ahead in the 32nd minute when Hamid spilled a dipping Pozuelo shot from outside the penalty box. The rebound went to Delgado, who beat Steven Birnbaum to the ball to tuck it in.

The goal ended D.C. United's 536-minute shutout streak dating back to a 3-1 loss Aug. 24 in Philadelphia. Hamid had posted five straight clean sheets since.

Rooney, meanwhile, said goodbye to MLS with the loss, exiting after the first half of extra time. The 33-year-old, who managed 23 goals and 15 assists in 48 regular-season games for D.C. United, is returning to England to join Derby County.

Wayne Rooney played in his final MLS game on Saturday. The Manchester United legend will be returning to England as a player-coach for Derby County, a second tier English division team. (Vaughn Ridley/Getty Images)

Rooney, who did not speak to the media after the game, had two excellent scoring chances midway through the second half but was stopped both times by Westberg.

The D.C. attack was toothless in the first half, however. Without a shot on target, the visitors brought on Kamara in the 44th minute, with Rooney dropping back.

D.C. finally put a shot on target in the 62nd minute when Westberg easily handled Rooney's shot from distance. Westberg had to make a more difficult one-handed save two minutes later off Rooney and soon after made a reflex save to stop Rooney from close-in.

Toronto and D.C. arrived with identical 13-10-11 records with Toronto grabbing fourth place in the East and a home playoff game on goal difference the final day of the season.

Toronto's last loss came Aug. 3 when it was beaten 2-0 at the New York Red Bulls. It has lost just two of its last 16 outings (8-2-6) since the end of the Gold Cup in early July.

D.C. United went undefeated in its final five regular season matches (3-0-2).

Wednesday's Eastern semifinal will be played at Citi Field, home of the Mets, due to the Yankees' playoff run.

Sounders outlast Dallas

Jordan Morris scored in the 113th minute to complete a hat trick in the Settle Sounders' 4-3 extra-time victory over FC Dallas.

Twice, the Sounders had the lead, only to see Dallas come back and tie. Ruidiaz scored in the 18th minute and Morrisin the 22nd to put Seattle in front, 2-0.

The Sounders advanced to the West semifinals, where they will meet Real Salt Lake, who defeated the Portland Timbers 2-1 later in the night.

Escobar sends Atlanta past New England

Franco Escobar's goal at the 69th minute broke a scoreless match and Atlanta United made it hold up with a 1-0 win.

Escobar took a short pass from Ezequiel Barco at the right side of the box and carried a shot over diving keeper Matt Turner. It was Escobar's second goal of the season.

The defending champs entered the playoffs as the second seed in the Eastern Conference and advanced to play the winner of Sunday's contest between No. 3-seed Philadelphia and sixth-seeded New York Red Bulls.

RSL eliminates Timbers

Jefferson Savarino scored in the 87th minute and Real Salt Lake beat the Portland Timbers 2-1.

RSL will now face the Seattle Sounders in the conference semifinals on Wednesday night.