The game, which ended at 1:50 2 a.m., was the longest in Turner Field history and matched the longest in the major leagues this season. At 6 hours, 39 minutes, it was the longest by time for both teams.
Lugo took on Scott Proctor's grounder to third baseman Pedro Alvarez, whose throw to catcher Michael McKenry easily beat Lugo to the plate.
Lugo tried to avoid McKenry's tag with a pop-up slide. Replays indicated McKenry made the tag, but home plate umpire Jerry Meals called Lugo safe.
Pirates manager Clint Hurdle argued the call vigorously, following Meals off the field as the Braves celebrated.
With their bench and bullpen depleted, the Braves had to let Proctor (2-3), their eighth pitcher of the game, hit for himself. Schafer advanced to second without a throw before Proctor's grounder led to the final play.
The Phillies and Reds played 19 innings on May 25.
The Pirates' previous longest game was 6:12 at San Diego on Aug. 25, 1979. The Braves' previous longest game by time was 6:10 against the Mets on July 4, 1985, at Atlanta-Fulton County Stadium.
The Pirates scored two runs in the first and pushed their lead to 3-0 in the second on McKenry's homer. The Braves answered with three runs in the third, and the score remained 3-3 through the next 15 innings.
Several thousand fans from the announced crowd of 22,036 were still in the stands in the 19th inning, many standing and chanting.
The Braves lost catcher Brian McCann in the 10th inning when he strained his left oblique. He will be placed on the 15-day disabled list on Wednesday.
McCutchen (3-2) gave up one run in 5 1-3 innings.
The Pirates fell one game behind first-place St. Louis in the NL Central.
The Pirates had a chance to avoid extra innings but wasted a scoring chance in the ninth. McKenry had an infield single off Craig Kimbrel and moved to third on pinch-hitter Brandon Wood's single.
The Braves called a pitchout as Xavier Paul was squaring to bunt and McKenry was running toward the plate. McKenry stopped too late and was thrown out at third. Kimbrel struck out Paul to end the inning.
Atlanta's Chipper Jones, who strained his right quadriceps in Monday night's game, hit a groundout as a pinch-hitter in the eighth.
Jones, 39, came off the 15-day disabled list on Monday following arthroscopic surgery on July 9 to repair torn cartilage in his right knee.
Nate McLouth and manager Fredi Gonzalez were ejected by Meals in the ninth. McLouth struck out swinging and then remained at the plate, apparently to argue a called strike two by Meals. Gonzalez ran onto the field too late to intervene and keep McLouth in the game.
NOTES: It was the Pirates' longest game since May 27, 2006, when they beat Houston 8-7 in 18 innings. It was the Braves' longest since Oct. 5, 2006, when they won 7-6 at Houston in 18 innings.... McKenry ended the Pirates' streak of 77 innings without a homer since a shot by Brandon Wood at Houston on July 16. ... Schafer, still bothered by his jammed left middle finger he hurt Wednesday in Colorado, was scratched from the Braves' lineup. He entered the game in the ninth as a defensive replacement in center. ... Pirates C Ryan Doumit (left ankle sprain) began a rehab assignment with Triple-A Indianapolis.