Chile is the longest: 4,329 km (2,690 mi) from Arica to Cape Horn.
Brazil is fifth: 4,320 km (2,684 mi) (Chuí to Monte Caburaí).
The difference is just 9 km — but Chile's extreme longitudinal stretch (17° to 56° S) gives it the title. Brazil's length is similarly vast but slightly shorter.
Top 5: 1) Chile, 2) Russia, 3) Canada, 4) USA, 5) Brazil.