In a game that was light on collective excitement and overall pace for more than an hour, it proved to be a wild finish. D.C. United (4-10-6, 18 points), who entered last in the Eastern Conference, broke a scoreless tie with Russell Canouse's header off a Julian Gressel free kick in the 77th minute.
D.C. United's 17-year-old midfielder Kevin Paredes made his way into the left side of the box and found Riva, who then drilled a left-footed shot over Atlanta keeper Brad Guzan and into the roof of the goal for the eventual winner.
It was a far cry from the last time the sides met in the nation's capital on Oct. 3. Atlanta won that one 4-0, but it has scored just two goals while going 0-3-2 since. Atlanta United remained outside of a playoff spot in the Eastern Conference.
D.C. United is now 2-0-1 following a five-game losing streak and has won back-to-back games for the first time in 2020. The unbeaten stretch matches the club's longest of the season.
In a quiet first half, both sides had decent chances. D.C. United's two best opportunities came off a free kick from Junior Moreno about midway through the opening 45 minutes.
Atlanta, meanwhile, got two quality looks near the end of the half. First, Ezequiel Barco drove a laser from the corner of the 18-yard box that D.C. United keeper Bill Hamid caught. Marcelino Moreno had a similar chance that Hamid saved just before the break.