"It just shows the drive of the team," said the 22-year-old Riley, who made his major league debut May 15.. "You never know what's going to happen. It shows a lot about this team."
Freddie Freeman added a two-run homer, his 15th, in a three-run ninth inning that sealed the Braves' third straight win.
Riley sent a slider from Kyle Crick (2-2) over the wall in right field for his ninth home run of the season in the seventh, turning a 5-3 deficit into a one-run lead. Donaldson pushed the lead to 9-5 in the eighth with a 439-foot shot to left-center field for his eighth.
"I just go out and try to execute my pitches," Crick said regarding Riley's homer. "Whatever happens, happens. In that particular 0-1 slider, I think I executed the pitch. Just a better piece of hitting."
Before Donaldson's eighth-inning home run, Freeman hit his 300th major-league double to right field.
"When you sit back and look at it, it just means I've been here a while," Freeman said. "I've had some success and it's pretty cool. It really is."
Dan Winkler (2-1) had one strikeout in a scoreless sixth inning to get the win.
Three Pirates errors partially contributed to five Braves runs. The three on Riley's home run came after left fielder Bryan Reynolds dropped a soft line drive from Nick Markakis with one out in the seventh.
Ronald Acuna Jr. came home for the opening run of the game after stealing third when catcher Elias Diaz threw the ball into left field in the first. Riley cut Pittsburgh's lead to 5-3 in the sixth by scoring on a pinch-hit single from Matt Joyce after reaching on a gaffe by third baseman Kevin Newman.
"I feel good about it," Braves manager Brian Snitker said. "I felt good once we got down that if we could just hold it, throw up some zeroes and give those guys a chance, they'd come back."
Melky Cabrera had two hits and three RBI, batting cleanup for Pittsburgh in place of Josh Bell. He hit a two-run homer to left, giving the Pirates a 2-1 lead with two outs in the bottom of the first and then added an RBI single that made it 5-2 with two outs in the second.
"(Cabrera) watches a lot of video. He hunts pitches," Pirates manager Clint Hurdle said. "If you look tonight, there are three times he fired first pitch, looking for pitches, he goes up and hunts and sometimes they throw what he's hunting. He doesn't miss it very often."
Bell, the National League Player for the Month for May, was given the day off after playing the Pirates' first 58 games this season. He is batting .332 with 18 home runs and 53 RBI, but was 1 for 10 with six strikeouts in his past two games.
Braves starter Max Fried gave up a season-high five runs and nine hits in four innings.
Steven Brault allowed two runs and five hits in four innings for the Pirates.
Braves: C Tyler Flowers replaced Brian McCann behind the plate. Snitker said McCann was not injured and could catch the next three games. Flowers, a right-handed bat, entered the lineup to match up against the lefty-throwing Brault.
Pirates: OF Gregory Polanco did not play after sitting to start Pittsburgh's 4-2 loss to Milwaukee on Sunday before pinch-hitting in the ninth inning. He has two hits and 11 strikeouts in his past 19 at bats.
Braves: RHP Kevin Gausman (2-4, 5.56) will take the mound for the second game of the three-game set. He went just one inning in his last outing, allowing eight runs and eight hits in a 14-4 loss to Washington last Wednesday.
Pirates: RHP Joe Musgrove (3-6, 4.57) has lost six of his past eight decisions. He gave up 11 runs and 21 hits in 11 innings during his past two starts.
More AP baseball: https://apnews.com/MLB and www.twitter.com/AP-Sports
Slumping Padres look to fix mistakes against Cubs
The heat figures to be on again Saturday at a sweltering Wrigley Field as the Padres and Cubs meet for the second game of a three-game series.
Semien 3 extra-base hits, surging A's beat Twins 5-3
Marcus Semien led off the game with a home run and later tripled and homered as the Oakland Athletics kept rolling, topping the Minnesota Twins 5-3 on a sweltering Friday night.
Davis, Pinder propel A's in 6th
Khris Davis and Chad Pinder each record RBI singles in the top of the sixth to lead Oakland to a 5-3 win against Minnesota.
Verlander strikes out 12, Astros beat Rangers 4-3
Justin Verlander struck out 12 in six solid innings, four Houston players hit solo home runs and the Astros held on to beat the Texas Rangers 4-3 on Friday night.
Martinez, Cards score 10 runs in 6th, rally past Reds 12-11
Jose Martinez homered and singled during a 10-run rally in the sixth inning and the St. Louis Cardinals overcame a seven-run deficit Friday night for a wild 12-11 win over the Cincinnati Reds.
Donaldson's 9th-inning single lifts Braves over Nats 4-3
Josh Donaldson's bases-loaded single off Fernando Rodney in the ninth inning lifted the Atlanta Braves over the Washington Nationals 4-3 on Friday night after Luke Jackson allowed a tying, two-run homer to Victor Robles in the top half.