Gordon, seeing a record fifth Brickyard 400 victory, held a 1.2-second lead over Johnson, the five-time Sprint Cup Series champion who also is a three-time winner of the Brickyard 400.
Kasey Kahne, who led nearly 40 laps early in the race, was running fourth and Matt Kenseth fifth.
Earnhardt also led several laps earlier in the 160-lap race moments after it appeared he had suffered a big setback.
He was forced to pit his No. 88 Chevrolet because it was overheating, which dropped the fan favorite to 29th. But the caution flag came out a few laps later and, when most of the 43-car field made pit stops, Earnhardt stayed on the track to gain back positions.
When the race restarted, Earnhardt -- who has gone 112 races with a victory -- took the lead and the crowd erupted on the front straightaway.
--Jim Peltz in Indianapolis
Photo: Kasey Kahne leads the field early in the Brickyard 400 on Sunday at Indianapolis Motor Speedway. Credit: John Harrelson /Getty Images