Pity Martinez’s goal in the 89th minute and another by Josef Martinez in extra time lifted Atlanta United to a 2-0 win over D.C. United on Sunday at Mercedes-Benz Stadium.

Pity Martinez’s goal, his third of the season, offset a rare missed penalty kick by Josef Martinez and several good saves by D.C. United goalkeeper Bill Hamid. Josef Martinez made up for the miss with his 16th goal, which came on a breakaway. Pity Martinez was credited with the assist.

With the win, Atlanta United is 3-3-1 in its past seven and kept pace with first-place Philadelphia in front an announced attendance of 44,405. The Five Stripes (11-8-3) trail the Union by three points but have played one less game. D.C. United (9-6-8) dropped to third in the East. Atlanta United will travel to LAFC, which leads MLS with 46 points, on Friday.

Pity Martinez delivered after coming on as a substitute, the second straight game he has not started.

“I’ve always had confidence in him,” Atlanta United manager Frank de Boer said of Pity Martinez. “I only look for the best team at the moment. That’s why they hired me to do that. I always feel for players. I know he expected much more of himself. The only reaction he can give me is this. I asked him to be in the box. He was in the box when the cross came. This is what you expect when you play behind the striker. He has to make my life as hard as possible. He’s doing that right now. I only choose the team with the most possibility to win. I saw a fantastic Pity today.”

Josef Martinez's missed penalty kick in the 71st minute was just his second in 15 attempts during the regular season with Atlanta United.

Atlanta United dominated possession but had trouble turning that advantage into shots on goal throughout the game. When they did, Hamid was there with four saves through 85 minutes. Brad Guzan increased his league-leading shutout total to 10.

After using a 3-5-2 formation in Wednesday’s 5-0 win against Houston, de Boer kept it, with a few personnel changes, on Sunday. Guzan against started as goalkeeper, with Franco Escobar, in for Michael Parkhurst, Miles Robinson and Leandro Gonzalez Pirez as the centerbacks. The defensive midfielders were Eric Remedi, in for Jeff Larentowicz, and Darlington Nagbe. The wide midfielders were Julian Gressel and Justin Meram, in for Dion Pereira, with Emerson Hyndman in the middle. The strikers were Brandon Vazquez and Josef Martinez. Ezequiel Barco made the 18 for the first time in a league game since May 5.

» PHOTOS:  A look at Atlanta United's late victory

D.C. United played without Wayne Rooney because of minor injuries. However, Hamid and Luciano Acosta, who have played very well in past games against Atlanta United, returned to the starting lineup after not featuring in the team’s win against Cincinnati on Thursday. Acosta played on Sunday as a “false 9,” which means he was given the freedom to move around the midfielder or play as a striker. The False 9 is a tactic Toronto used to befuddle the Five Stripes for the opening minutes of its 3-2 win on June 26.

The game-winner started with Gressel splitting two D.C. United defenders with a pass to Nagbe near the top of the penalty box. Nagbe continued his run and, as he neared the end line, chipped a cross over one D.C. United defender and over Hamid to Pity Martinez, who headed it in from inches away. With the assist, Gressel broke Miguel Almiron's franchise record of 28. Nagbe was credited with his second assist.

“We know whoever is doing things well, they are going to play,” Pity Martinez said.

Pity Martinez showed the vision that helped him become last year’s South American Player of the Year on the second goal. Receiving the ball on Atlanta United’s side of the field, Martinez lobbed a pass into space behind D.C. United’s defense. Josef Martinez ran onto the pass and beat Hamid with a chipped shot in the second minute of stoppage time. It was Pity Martinez’s sixth assist.

“We made the game and created our chances,” de Boer said. “In the second half we were concentrated and really wanted to go for the win. ... For me, it was really satisfying to see that everyone was involved. Only one team deserved to win tonight and it was Atlanta United.”

Hamid was at his Atlanta United best early, twice stopping quality shots to his right and left by Josef Martinez in the first 15 minutes.

Guzan equaled, coming 12 yards out of his goal in the 33rd minute to get a trailing right foot on a shot by Paul Arriola, who was put into acres of space behind Atlanta United’s defense by Acosta.

Martinez was tackled hard late in the half in the penalty box, but referee Allen Chapman waved away the pleas for a penalty kick.

Gressel was taken down in the D.C. United penalty box around the 63rd minute, but again Chapman ruled no penalty.

Trying to inject some life into the offense, de Boer subbed on Pity Martinez for Vazquez in the 65th minute.

A corner kick four minutes later resulted in a low, curling header by Robinson that was again saved by Hamid diving back to his left.

The result looked like it was to change in the 71st minute when Josef Martinez was taken down in the box by Russell Canouse. Meram chipped a pass into the box. However, Martinez skied his penalty over the crossbar.