Messi curled home left-footed from 20 yards three minutes from time.
Kylian Mbappe had given PSG an early lead but the hosts were reduced to 10 men when goalkeeper Keylor Navas raced from his box to foul Ludovic Blas.
Nantes levelled via Randal Kolo Muani’s backheel but Dennis Appiah’s freak own goal and Messi’s measured shot won it.
The victory was Les Parisiens’ 12th in 14 league games and it looked set to be a routine affair after they dominated the first half, buoyed by Mbappe’s second-minute opener.
However, Nantes keeper Albon Lafont kept the visitors in it with a string of saves to thwart Messi and Neymar before his opposite number Navas saw red for a reckless rush of blood.
His replacement Sergio Rico, brought on for Neymar, saved well from Muani’s header but could not keep out the Nantes forward’s improvised rebound.
But Appiah’s interception of a Messi pass looped over Lafont from 20 yards before the former Barcelona playmaker – whose three previous PSG goals had all come in the Champions League – broke his domestic duck in his sixth Ligue 1 game